#include <cstdio>
#include <algorithm>
#define fin stdin
#define fout stdout
int a[100009];
int main(){
int n;
fscanf(fin, "%d", &n);
for(int i = 1; i <= n; i ++)
fscanf(fin, "%d", &a[i]);
long long ans = 0;
for(int i = 2; i <= n; i ++){
int aux = std::min(a[i], a[i-1]);
ans += aux;
a[i] -= aux;
a[i-1] -= aux;
}
for(int i = 1; i <= n; i ++)
ans += a[i] / 2;
fprintf(fout, "%I64d\n", ans);
return 0;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:27:33: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long long int’ [-Wformat=]
fprintf(fout, "%I64d\n", ans);
^
./Main.cpp:11:26: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fin, "%d", &n);
^
./Main.cpp:14:33: warning: ignoring return value of ‘int fscanf(FILE*, const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
fscanf(fin, "%d", &a[i]);
^