#include<stdio.h> #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n; scanf("%d",&n); unsigned long long int s=0; int nech=3000000,q; for(int i=0;i<n;i++) { scanf("%d",&q); s+=q; if(q%2==1) { nech=(nech<q)?nech:q; } } if(s%2==0) { printf("%Ld",s); } else if(nech!=3000000 && s-nech>0) { printf("%Ld",s-nech); } else { printf("NIESTETY"); } 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 37 38 | #include<stdio.h> #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n; scanf("%d",&n); unsigned long long int s=0; int nech=3000000,q; for(int i=0;i<n;i++) { scanf("%d",&q); s+=q; if(q%2==1) { nech=(nech<q)?nech:q; } } if(s%2==0) { printf("%Ld",s); } else if(nech!=3000000 && s-nech>0) { printf("%Ld",s-nech); } else { printf("NIESTETY"); } return 0; } |