#include <iostream> #include <string> int cnt[5][3]={0}; bool is_ok() { for(int round=0;round<5;++round) for(int div=0;div<3;++div) if(cnt[round][div]<(round==4?2:1)) return false; return true; } int main() { int n; std::cin >> n; for(int i=0;i<n;++i) { std::string s; std::cin >> s; int round=s[0]-'1'; int div=s[1]-'A'; ++cnt[round][div]; } std::cout << (is_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 | #include <iostream> #include <string> int cnt[5][3]={0}; bool is_ok() { for(int round=0;round<5;++round) for(int div=0;div<3;++div) if(cnt[round][div]<(round==4?2:1)) return false; return true; } int main() { int n; std::cin >> n; for(int i=0;i<n;++i) { std::string s; std::cin >> s; int round=s[0]-'1'; int div=s[1]-'A'; ++cnt[round][div]; } std::cout << (is_ok()?"TAK":"NIE"); return 0; } |