Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n,i,v[101];
  6.  
  7. int main()
  8. {
  9. cin>>n;
  10. for(int i=1;i<=n;i++)
  11. cin>>v[i];
  12. for(int i=1;i<n;i++)
  13. {
  14. cout<<v[i]<<" ";
  15. if((v[i]%2==0 && v[i+1]%2==0) || (v[i]%2!=0 && v[i+1]%2!=0))
  16. cout<<(v[i]+v[i+1])/2<<" ";
  17. }
  18. cout<<v[n];
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement