#include <iostream>
using namespace std;
int n, t[16]={}, ok=0;
string a;
int main()
{
std::ios_base::sync_with_stdio(0);
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a;
t[(((int)a[0])-48)*3-((int)a[1])+65]++;
}
for(int i=1;i<=12;i++)
{
if(t[i]<1) ok++;
}
for(int i=13;i<=15;i++)
{
if(t[i]<2) ok++;
}
if(ok==0) 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 | #include <iostream> using namespace std; int n, t[16]={}, ok=0; string a; int main() { std::ios_base::sync_with_stdio(0); cin>>n; for(int i=0;i<n;i++) { cin>>a; t[(((int)a[0])-48)*3-((int)a[1])+65]++; } for(int i=1;i<=12;i++) { if(t[i]<1) ok++; } for(int i=13;i<=15;i++) { if(t[i]<2) ok++; } if(ok==0) cout<<"TAK"; else cout<<"NIE"; return 0; } |
English