#include<bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int t[n], ln = 0, mn = 2000, w = 0; for(int i = 0; i < n; i++){ scanf("%d", &t[i]); if(t[i]%2==1){ mn = min(mn, t[i]); ln++;} w+=t[i];} if(ln==n and n==1){ printf("NIESTETY\n"); return 0;} if(ln%2==1) w-=mn; printf("%d\n", w); }
1 2 3 4 5 6 7 8 9 10 11 | #include<bits/stdc++.h> using namespace std; int main() { int n; scanf("%d", &n); int t[n], ln = 0, mn = 2000, w = 0; for(int i = 0; i < n; i++){ scanf("%d", &t[i]); if(t[i]%2==1){ mn = min(mn, t[i]); ln++;} w+=t[i];} if(ln==n and n==1){ printf("NIESTETY\n"); return 0;} if(ln%2==1) w-=mn; printf("%d\n", w); } |