-
Notifications
You must be signed in to change notification settings - Fork 3
/
Chief_Hopper.cpp
54 lines (50 loc) · 1.09 KB
/
Chief_Hopper.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
45
46
47
48
49
50
51
52
53
54
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <limits>
#include <cstring>
#include <string>
using namespace std;
#define pairii pair<int, int>
#define llong long long
#define pb push_back
#define sortall(x) sort((x).begin(), (x).end())
#define INFI numeric_limits<int>::max()
#define INFLL numeric_limits<llong>::max()
#define INFD numeric_limits<double>::max()
#define FOR(i,s,n) for (int (i) = (s); (i) < (n); (i)++)
#define FORZ(i,n) FOR((i),0,(n))
const int MAXN = 100005;
int ar[MAXN];
void solve() {
int n;
scanf("%d",&n);
FORZ(i,n) scanf("%d",ar+i);
int res = 0;
for (int i = n-1; i >= 0; i--) {
int x = res + ar[i];
res = x/2 + x%2;
}
printf("%d",res);
}
int main() {
#ifdef DEBUG
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
solve();
return 0;
}