#include <stdio.h> int main() { int n,i,x,r=0,v=1001,c=0;scanf("%d",&n); for(i=0;i<n;++i){scanf("%d",&x);if(x&1){++c;if(x<v)v=x;}r+=x;}if(c&1)r-=v; return !r?!printf("NIESTETY\n"):!printf("%d\n",r); }
1 2 3 4 5 6 | #include <stdio.h> int main() { int n,i,x,r=0,v=1001,c=0;scanf("%d",&n); for(i=0;i<n;++i){scanf("%d",&x);if(x&1){++c;if(x<v)v=x;}r+=x;}if(c&1)r-=v; return !r?!printf("NIESTETY\n"):!printf("%d\n",r); } |