-
Notifications
You must be signed in to change notification settings - Fork 0
/
B.cpp
45 lines (33 loc) · 704 Bytes
/
B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll ara[200009], ev[200009], od[200009];;
int main()
{
ll n;
cin >> n;;
for(ll i = 1; i <= n; i++) {
scanf("%lld", &ara[i]);;;
}
for(ll i = 1; i <= n; i++) {
if(i % 2 == 0) {
ev[i] = ara[i];
}
else {
od[i] = ara[i];
}
}
for(ll i = 1; i <= n; i++) {
od[i] += od[i - 1];
ev[i] += ev[i - 1];;
}
ll cnt = 0;
for(ll i = 1; i <= n; i++) {
ll os = od[i - 1] + ev[n] - ev[i];
ll es = ev[i - 1] + od[n] - od[i];
if(os == es)
cnt++;
}
cout << cnt << endl;
return 0;
}