SOLUTIA I
#include<iostream>
using namespace std;
int main() {
int n, x, si = 0, sp = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> x;
if (i % 2 == 0)
sp += x;
else
si += x;
}
cout << sp - si;
return 0;
}
SOLUTIA II
#include<iostream>
using namespace std;
int main() {
int n, v[100001], si = 0, sp = 0;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> v[i];
if (i % 2 == 0)
sp += v[i];
else
si += v[i];
}
cout << sp - si;
return 0;
}