#include<iostream> #include<string> using namespace std; int divisions[5][3]; int main(){ int n; cin >> n; for(int i = 0; i < n; i++) { string div; cin>>div; divisions[div[0]-'1'][div[1]-'A']++; } for(int i = 0; i < 4; i++) for(int j = 0; j < 3; j++) if(divisions[i][j] < 1) { cout<<"NIE"<<endl; return 0; } if(divisions[4][0] < 2 || divisions[4][1] < 2 || divisions[4][2] < 2) { cout << "NIE" << endl; } else cout << "TAK" << endl; 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 | #include<iostream> #include<string> using namespace std; int divisions[5][3]; int main(){ int n; cin >> n; for(int i = 0; i < n; i++) { string div; cin>>div; divisions[div[0]-'1'][div[1]-'A']++; } for(int i = 0; i < 4; i++) for(int j = 0; j < 3; j++) if(divisions[i][j] < 1) { cout<<"NIE"<<endl; return 0; } if(divisions[4][0] < 2 || divisions[4][1] < 2 || divisions[4][2] < 2) { cout << "NIE" << endl; } else cout << "TAK" << endl; return 0; } |