#include <cstdio> using namespace std; int main() { int n, suma=0; short int a, minniep=1001; scanf ("%d", &n); for (int i=0; i<n; i++) { scanf ("%hd", &a); suma+=a; if (a%2&&a<minniep) minniep=a; } if (suma%2) if (n==1) printf ("NIESTETY"); else printf ("%d", suma-minniep); else printf ("%d", suma); 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 | #include <cstdio> using namespace std; int main() { int n, suma=0; short int a, minniep=1001; scanf ("%d", &n); for (int i=0; i<n; i++) { scanf ("%hd", &a); suma+=a; if (a%2&&a<minniep) minniep=a; } if (suma%2) if (n==1) printf ("NIESTETY"); else printf ("%d", suma-minniep); else printf ("%d", suma); return 0; } |