#include <bits/stdc++.h>
using namespace std;
int c[6], b[6], a[6];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n; cin>>n;
if(n<18)
{
cout<<"NIE"; return 0;
}
string dp[n];
for(int i=0; i<n; i++)
{
cin>>dp[i];
if(dp[i][1]==65)
a[dp[i][0]-48]++;
if(dp[i][1]==66)
b[dp[i][0]-48]++;
if(dp[i][1]==67)
c[dp[i][0]-48]++;
}
for(int i=1; i<5; i++)
{
if(a[i]==0||b[i]==0||c[i]==0)
{
cout<<"NIE"; return 0;
}
}
if(a[5]<2||b[5]<2||c[5]<2)
{
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 | #include <bits/stdc++.h> using namespace std; int c[6], b[6], a[6]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin>>n; if(n<18) { cout<<"NIE"; return 0; } string dp[n]; for(int i=0; i<n; i++) { cin>>dp[i]; if(dp[i][1]==65) a[dp[i][0]-48]++; if(dp[i][1]==66) b[dp[i][0]-48]++; if(dp[i][1]==67) c[dp[i][0]-48]++; } for(int i=1; i<5; i++) { if(a[i]==0||b[i]==0||c[i]==0) { cout<<"NIE"; return 0; } } if(a[5]<2||b[5]<2||c[5]<2) { cout<<"NIE"; return 0; } cout<<"TAK"; return 0; } |
English