#include <cstdio> #include <vector> using namespace std; int main() { int n; scanf("%d",&n); char s[5]; vector<int> c(15); for (int i = 0; i < n; i++) { scanf("%s", s); c[(s[0]-'1')*3+(s[1]-'A')]++; } bool ok = true; for (int i = 0; i < 15; i++) if(c[i] < (i < 12 ? 1 : 2)) ok = false; puts(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 | #include <cstdio> #include <vector> using namespace std; int main() { int n; scanf("%d",&n); char s[5]; vector<int> c(15); for (int i = 0; i < n; i++) { scanf("%s", s); c[(s[0]-'1')*3+(s[1]-'A')]++; } bool ok = true; for (int i = 0; i < 15; i++) if(c[i] < (i < 12 ? 1 : 2)) ok = false; puts(ok ? "TAK" : "NIE"); return 0; } |