#include <bits/stdc++.h>
using namespace std;
int t[10][10];
int main()
{
int n;
cin>>n;
string s;
for(int i=0; i<n; ++i)
{
cin>>s;
++t[s[0]-'0'][s[1]-'A'];
}
int sum=0;
for(int i=1; i<=5; ++i)
{
for(int j=0; j<3; ++j)
{
sum+=min(1+(i==5), t[i][j]);
}
}
if(sum==18)
{
cout<<"TAK"<<endl;
}
else
{
cout<<"NIE"<<endl;
}
}
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 <bits/stdc++.h> using namespace std; int t[10][10]; int main() { int n; cin>>n; string s; for(int i=0; i<n; ++i) { cin>>s; ++t[s[0]-'0'][s[1]-'A']; } int sum=0; for(int i=1; i<=5; ++i) { for(int j=0; j<3; ++j) { sum+=min(1+(i==5), t[i][j]); } } if(sum==18) { cout<<"TAK"<<endl; } else { cout<<"NIE"<<endl; } } |
English