#include<bits/stdc++.h> using namespace std; bool p[20], pieca, piecb, piecc; int n; string s; int main() { cin>>n; if(n<18) { cout<<"NIE"; return 0; } while(n--) { cin>>s; if(s=="5A" and p[5]==true) pieca = true; if(s=="5B" and p[10]==true) piecb = true; if(s=="5C" and p[15]==true) piecc = true; if(s[1]=='A') p[s[0]-'0'] = true; if(s[1]=='B') p[s[0]-'0'+5] = true; if(s[1]=='C') p[s[0]-'0'+10] = true; } for(int i = 1;i<16;i++) { if(p[i]==false) { cout<<"NIE"; return 0; } } if(pieca==false or piecb==false or piecc==false) { cout<<"NIE"; return 0; } cout<<"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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include<bits/stdc++.h> using namespace std; bool p[20], pieca, piecb, piecc; int n; string s; int main() { cin>>n; if(n<18) { cout<<"NIE"; return 0; } while(n--) { cin>>s; if(s=="5A" and p[5]==true) pieca = true; if(s=="5B" and p[10]==true) piecb = true; if(s=="5C" and p[15]==true) piecc = true; if(s[1]=='A') p[s[0]-'0'] = true; if(s[1]=='B') p[s[0]-'0'+5] = true; if(s[1]=='C') p[s[0]-'0'+10] = true; } for(int i = 1;i<16;i++) { if(p[i]==false) { cout<<"NIE"; return 0; } } if(pieca==false or piecb==false or piecc==false) { cout<<"NIE"; return 0; } cout<<"TAK"; return 0; } |