#include <cstdio> #include <cmath> #include <algorithm> using namespace std; int main() { int n, note; int share = 0; int odd_note = 1001; int odd_count = 0; scanf("%d", &n); while(n--) { scanf("%d", ¬e); share += note; odd_count += note % 2; odd_count %= 2; if(note % 2 == 1 && note < odd_note) { odd_note = note; } } if(odd_count > 0) { share -= odd_note; } if (share == 0) { printf("NIESTETY\n"); } else { printf("%d\n", share); } 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 | #include <cstdio> #include <cmath> #include <algorithm> using namespace std; int main() { int n, note; int share = 0; int odd_note = 1001; int odd_count = 0; scanf("%d", &n); while(n--) { scanf("%d", ¬e); share += note; odd_count += note % 2; odd_count %= 2; if(note % 2 == 1 && note < odd_note) { odd_note = note; } } if(odd_count > 0) { share -= odd_note; } if (share == 0) { printf("NIESTETY\n"); } else { printf("%d\n", share); } return 0; } |