#include <bits/stdc++.h> using namespace std; const int N = 105; int n; int tab[6][3]; int main() { scanf("%d", &n); while (n--) { char s[3]; scanf("%s", &s); int i = s[0] - '0'; int j = s[1] - 'A'; tab[i][j]++; } for (int i = 1; i < 6; i++) { for (int j = 0; j < 3; j++) { if (tab[i][j] < max(1, i - 3)) { printf("NIE\n"); return 0; } } } printf("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 25 26 27 28 29 30 | #include <bits/stdc++.h> using namespace std; const int N = 105; int n; int tab[6][3]; int main() { scanf("%d", &n); while (n--) { char s[3]; scanf("%s", &s); int i = s[0] - '0'; int j = s[1] - 'A'; tab[i][j]++; } for (int i = 1; i < 6; i++) { for (int j = 0; j < 3; j++) { if (tab[i][j] < max(1, i - 3)) { printf("NIE\n"); return 0; } } } printf("TAK\n"); } |