#include <iostream> #include <map> using namespace std; inline int min(int a, int b) { if (a < b) { return a; } else { return b; } } inline int sum(int *collection, int size) { int sum = 0; for (int i = 0; i < size; i++) { sum += collection[i]; } return sum; } int main() { const int arraySize = 100; int ctr[arraySize] = { 0 }; int n; cin >> n; for (int i = 0; i < n; i++) { int a, maxValue = 1; cin >> hex >> a; if (a >= 90) { maxValue = 2; } ctr[a] = min(ctr[a] + 1, maxValue); } if (sum(ctr, arraySize) == 18) { cout << "TAK"; } else { cout << "NIE"; } 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 39 40 41 42 43 44 45 | #include <iostream> #include <map> using namespace std; inline int min(int a, int b) { if (a < b) { return a; } else { return b; } } inline int sum(int *collection, int size) { int sum = 0; for (int i = 0; i < size; i++) { sum += collection[i]; } return sum; } int main() { const int arraySize = 100; int ctr[arraySize] = { 0 }; int n; cin >> n; for (int i = 0; i < n; i++) { int a, maxValue = 1; cin >> hex >> a; if (a >= 90) { maxValue = 2; } ctr[a] = min(ctr[a] + 1, maxValue); } if (sum(ctr, arraySize) == 18) { cout << "TAK"; } else { cout << "NIE"; } return 0; } |