#include <iostream> using namespace std; int main(int argc, char** argv) { int n; int taskNumbers[15] = {0}; cin >> n; for (int i = 0; i<n; i++) { string idea; cin >> idea; int lvl = (idea[0] - '1'); int type = (idea[1] - 'A'); taskNumbers[lvl * 3 + type] += 1; } bool canComplete = true; for (int i = 0; i < 5*3; i++) { if (taskNumbers[i] < 1) { canComplete = false; break; } if (i >= 4*3 && taskNumbers[i] < 2) { canComplete = false; break; } } if (canComplete) { cout << "TAK" << endl; } else { cout << "NIE" << endl; } 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 | #include <iostream> using namespace std; int main(int argc, char** argv) { int n; int taskNumbers[15] = {0}; cin >> n; for (int i = 0; i<n; i++) { string idea; cin >> idea; int lvl = (idea[0] - '1'); int type = (idea[1] - 'A'); taskNumbers[lvl * 3 + type] += 1; } bool canComplete = true; for (int i = 0; i < 5*3; i++) { if (taskNumbers[i] < 1) { canComplete = false; break; } if (i >= 4*3 && taskNumbers[i] < 2) { canComplete = false; break; } } if (canComplete) { cout << "TAK" << endl; } else { cout << "NIE" << endl; } return 0; } |