#include <iostream> using namespace std; int task[15]; inline int index(const char* str) { return (3*(str[0]-'1') + (str[1]-'A')); } int main() { int n; std::string s; cin >> n; while(n--) { cin >> s; task[index(s.c_str())]++; } bool ok = true; for(int i=0; i<12; ++i) { ok &= (task[i] > 0); } for(int i=12; i<15; ++i) { ok &= (task[i] > 1); } cout << (ok ? "TAK" : "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 | #include <iostream> using namespace std; int task[15]; inline int index(const char* str) { return (3*(str[0]-'1') + (str[1]-'A')); } int main() { int n; std::string s; cin >> n; while(n--) { cin >> s; task[index(s.c_str())]++; } bool ok = true; for(int i=0; i<12; ++i) { ok &= (task[i] > 0); } for(int i=12; i<15; ++i) { ok &= (task[i] > 1); } cout << (ok ? "TAK" : "NIE"); return 0; } |