#include <iostream> #include <stdio.h> using namespace std; int main() { int n; int w[300][300] = {0}; char s[10]; scanf("%d\n", &n); for (int q=0; q<n; q++) { scanf("%s",s); w[s[0]][s[1]]++; } for (char c1='1'; c1<'5'; c1++) for (char c2='A'; c2<='C' ;c2++) if (w[c1][c2]<1) {printf("NIE"); return 0;} for (char c2='A'; c2<='C' ;c2++) if (w['5'][c2]<2) {printf("NIE"); return 0;} printf("TAK"); 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 | #include <iostream> #include <stdio.h> using namespace std; int main() { int n; int w[300][300] = {0}; char s[10]; scanf("%d\n", &n); for (int q=0; q<n; q++) { scanf("%s",s); w[s[0]][s[1]]++; } for (char c1='1'; c1<'5'; c1++) for (char c2='A'; c2<='C' ;c2++) if (w[c1][c2]<1) {printf("NIE"); return 0;} for (char c2='A'; c2<='C' ;c2++) if (w['5'][c2]<2) {printf("NIE"); return 0;} printf("TAK"); return 0; } |