#include <iostream> #include <string> using namespace std; int tab[3][5]; int main(int argc, char* argv[]) { ios_base::sync_with_stdio (false); string str; int i, n, j; cin >> n; for (i=0; i<n; ++i) { cin >> str; tab[str[1]-'A'][str[0]-'1']++; } for (i=0;i<3;i++) for (j=0; j<4;j++) if(tab[i][j] < 1) goto err; for (i=0;i<3;i++) if(tab[i][4] < 2) goto err; cout << "TAK\n"; return 0; err: cout << "NIE\n"; 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 | #include <iostream> #include <string> using namespace std; int tab[3][5]; int main(int argc, char* argv[]) { ios_base::sync_with_stdio (false); string str; int i, n, j; cin >> n; for (i=0; i<n; ++i) { cin >> str; tab[str[1]-'A'][str[0]-'1']++; } for (i=0;i<3;i++) for (j=0; j<4;j++) if(tab[i][j] < 1) goto err; for (i=0;i<3;i++) if(tab[i][4] < 2) goto err; cout << "TAK\n"; return 0; err: cout << "NIE\n"; return 0; } |