//08.12.20 18:03 start #include <iostream> using namespace std; int main() { string data; int n; cin>>n; bool result = true; int i,j,k; int index1; int index2; int tab[5][3]; for(i=0;i<5;++i){ for(j=0;j<3;++j){ tab[i][j] = 0; }//for }//for for(k=0;k<n;++k){ cin>>data; index1 = data[0]; index2 = data[1]; index1 -= '0'; --index1; index2 -= 'A'; //cout<<"index1 wynosi "<<index1<<" a index2 wynosi "<<index2<<endl; ++tab[index1][index2]; }//for for(i=0;i<5;++i){ for(j=0;j<3;++j){ if(!(tab[i][j])){ result = false; }//if if(i==4 && (j==0 || j==1 || j==2)){ if(tab[i][j] < 2) result = false; }//if }//for2 }//for if(result) cout<<"TAK"; else cout <<"NIE"; 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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | //08.12.20 18:03 start #include <iostream> using namespace std; int main() { string data; int n; cin>>n; bool result = true; int i,j,k; int index1; int index2; int tab[5][3]; for(i=0;i<5;++i){ for(j=0;j<3;++j){ tab[i][j] = 0; }//for }//for for(k=0;k<n;++k){ cin>>data; index1 = data[0]; index2 = data[1]; index1 -= '0'; --index1; index2 -= 'A'; //cout<<"index1 wynosi "<<index1<<" a index2 wynosi "<<index2<<endl; ++tab[index1][index2]; }//for for(i=0;i<5;++i){ for(j=0;j<3;++j){ if(!(tab[i][j])){ result = false; }//if if(i==4 && (j==0 || j==1 || j==2)){ if(tab[i][j] < 2) result = false; }//if }//for2 }//for if(result) cout<<"TAK"; else cout <<"NIE"; return 0; } |