#include <bits/stdc++.h>
using namespace std;
long long int tab[10][5];
int main(){
int n;
cin>>n;
for(int i=0; i<n; i++){
string m;
cin>>m;
tab[m[0]-'0'][m[1]-'A']++;
}
for(int i=1; i<=5; i++){
for(int j=0; j<3; j++){
if(i<5 && tab[i][j]<1){
cout<<"NIE";
return 0;
}
if(i==5 && tab[i][j]<2){
cout<<"NIE";
return 0;
}
}
}
cout<<"TAK";
}
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 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <bits/stdc++.h> using namespace std; long long int tab[10][5]; int main(){ int n; cin>>n; for(int i=0; i<n; i++){ string m; cin>>m; tab[m[0]-'0'][m[1]-'A']++; } for(int i=1; i<=5; i++){ for(int j=0; j<3; j++){ if(i<5 && tab[i][j]<1){ cout<<"NIE"; return 0; } if(i==5 && tab[i][j]<2){ cout<<"NIE"; return 0; } } } cout<<"TAK"; } |
English