#include <iostream> using namespace std; const int ROUNDS_CNT = 5, DIFFICULTIES = 3; int biject(string s) { return 3 * (s[0] - '1') + s[1] - 'A'; } void wyb() { const int PROBLEMS_CNT = ROUNDS_CNT * DIFFICULTIES; int n, cnt[PROBLEMS_CNT] {}; cin >> n; for (int i = 0; i < n; ++i) { string s; cin >> s; ++cnt[biject(s)]; } for (int i = 0; i < PROBLEMS_CNT - 1 * DIFFICULTIES; ++i) { if (cnt[i] < 1) { cout << "NIE" << endl; return; } } for (int i = PROBLEMS_CNT - 1 * DIFFICULTIES; i < PROBLEMS_CNT; ++i) { if (cnt[i] < 2) { cout << "NIE" << endl; return; } } cout << "TAK" << endl; } int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); wyb(); 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 | #include <iostream> using namespace std; const int ROUNDS_CNT = 5, DIFFICULTIES = 3; int biject(string s) { return 3 * (s[0] - '1') + s[1] - 'A'; } void wyb() { const int PROBLEMS_CNT = ROUNDS_CNT * DIFFICULTIES; int n, cnt[PROBLEMS_CNT] {}; cin >> n; for (int i = 0; i < n; ++i) { string s; cin >> s; ++cnt[biject(s)]; } for (int i = 0; i < PROBLEMS_CNT - 1 * DIFFICULTIES; ++i) { if (cnt[i] < 1) { cout << "NIE" << endl; return; } } for (int i = PROBLEMS_CNT - 1 * DIFFICULTIES; i < PROBLEMS_CNT; ++i) { if (cnt[i] < 2) { cout << "NIE" << endl; return; } } cout << "TAK" << endl; } int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); wyb(); return 0; } |