Advertisement
andreim618

Untitled

May 27th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n, i, x, y, ma, s;
  4. int v[105];
  5. int main()
  6. {
  7.     cin >> n;
  8.     for(i = 1; i <= n; i ++)
  9.         cin >> v[i];
  10.     for(i = 1; i < n; i++)
  11.     {
  12.         cout << v[i] << " ";
  13.         x = abs(v[i]);
  14.         y = abs(v[i + 1]);
  15.         s = x + y;
  16.         ma=(v[i] + v[i + 1]) / 2;
  17.         if(s % 2 == 0) cout << ma << " ";
  18.     }
  19.     cout << v[n];
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement