//============================================================================
// Name : potyczki2015.cpp
// Author : Hanczar
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <cstdio>
#include <stdint.h>
int main() {
int n;
int64_t sum = 0;
int64_t smallestnegative;
scanf("%d",&n);
while (n--){
int value;
scanf("%d",&value);
sum+=value;
if (value&1) {
if (value < smallestnegative || smallestnegative == 0) {
smallestnegative = value;
}
}
}
if (sum & 1 ) {
sum -= smallestnegative;
}
if (0==sum) {
printf("NIESTETY");
} else {
printf("%lld\n",(long long int)sum);
}
return 0;
}
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 | //============================================================================ // Name : potyczki2015.cpp // Author : Hanczar // Version : // Copyright : Your copyright notice // Description : Hello World in C++, Ansi-style //============================================================================ #include <cstdio> #include <stdint.h> int main() { int n; int64_t sum = 0; int64_t smallestnegative; scanf("%d",&n); while (n--){ int value; scanf("%d",&value); sum+=value; if (value&1) { if (value < smallestnegative || smallestnegative == 0) { smallestnegative = value; } } } if (sum & 1 ) { sum -= smallestnegative; } if (0==sum) { printf("NIESTETY"); } else { printf("%lld\n",(long long int)sum); } return 0; } |
English