#include <cstdio>
long long n, s, a, b;
int main() {
freopen("input.txt", "r", stdin);
scanf("%d", &n);
while(n--) {
scanf("%d", &a);
if(!a) b=0;
b += a;
s += b/2;
b %= 2;
}
printf("%lld", s);
return 0;
}
./Main.cpp: In function ‘int main()’:
./Main.cpp:5:16: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
scanf("%d", &n);
^
./Main.cpp:7:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
scanf("%d", &a);
^
./Main.cpp:4:34: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
freopen("input.txt", "r", stdin);
^
./Main.cpp:5:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &n);
^
./Main.cpp:7:18: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d", &a);
^