#include <iostream> #include <string> using namespace std; int main() { ios_base::sync_with_stdio(0); int N; cin >> N; int needs[] = {1,1,1,1,2,1,1,1,1,2,1,1,1,1,2}; for (int i = 0; i < N; i++) { string s; cin >> s; int n = s[0]-'1'; int m = s[1]-'A'; needs[n+5*m]--; } int m = -1; for (auto n: needs) m = max(m, n); if (m>0) cout << "NIE\n"; else cout << "TAK\n"; 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 | #include <iostream> #include <string> using namespace std; int main() { ios_base::sync_with_stdio(0); int N; cin >> N; int needs[] = {1,1,1,1,2,1,1,1,1,2,1,1,1,1,2}; for (int i = 0; i < N; i++) { string s; cin >> s; int n = s[0]-'1'; int m = s[1]-'A'; needs[n+5*m]--; } int m = -1; for (auto n: needs) m = max(m, n); if (m>0) cout << "NIE\n"; else cout << "TAK\n"; return 0; } |