#include <bits/stdc++.h> using namespace std; int cnt[6][3], n; int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; ++cnt[s[0]-'0'][s[1]-'A']; } for (int i = 0; i < 3; i++) { for (int j = 1; j <= 4; j++) if (cnt[j][i] == 0) return cout << "NIE\n", 0; if (cnt[5][i] < 2) return cout << "NIE\n", 0; } cout << "TAK\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <bits/stdc++.h> using namespace std; int cnt[6][3], n; int main() { ios_base::sync_with_stdio(0);cin.tie(0); cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; ++cnt[s[0]-'0'][s[1]-'A']; } for (int i = 0; i < 3; i++) { for (int j = 1; j <= 4; j++) if (cnt[j][i] == 0) return cout << "NIE\n", 0; if (cnt[5][i] < 2) return cout << "NIE\n", 0; } cout << "TAK\n"; } |