Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int n, i, x, y, ma, s;
- int v[105];
- int main()
- {
- cin >> n;
- for(i = 1; i <= n; i ++)
- cin >> v[i];
- for(i = 1; i < n; i++)
- {
- cout << v[i] << " ";
- x = abs(v[i]);
- y = abs(v[i + 1]);
- s = x + y;
- ma=(v[i] + v[i + 1]) / 2;
- if(s % 2 == 0) cout << ma << " ";
- }
- cout << v[n];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement