#include <iostream>
#include <vector>
#include <cstring>
using namespace std;
int main()
{ std::ios_base::sync_with_stdio(0);
int n;
cin>>n;
int t[6][3]={};
for(int i=0;i<n;i++)
{string h;
cin>>h;
t[h[0]-48][h[1]-65]++;
}
for(int i=1;i<5;i++)
{if(t[i][0]==0||t[i][1]==0||t[i][2]==0){cout<<"NIE"; return 0;}
}
if(t[5][0]>=2&&t[5][1]>=2&&t[5][2]>=2)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 | #include <iostream> #include <vector> #include <cstring> using namespace std; int main() { std::ios_base::sync_with_stdio(0); int n; cin>>n; int t[6][3]={}; for(int i=0;i<n;i++) {string h; cin>>h; t[h[0]-48][h[1]-65]++; } for(int i=1;i<5;i++) {if(t[i][0]==0||t[i][1]==0||t[i][2]==0){cout<<"NIE"; return 0;} } if(t[5][0]>=2&&t[5][1]>=2&&t[5][2]>=2)cout<<"TAK"; else cout<<"NIE"; return 0; } |
English