#include <iostream>
#include <map>
using namespace std;
int n;
bool czy;
map<string,int> m;
string s;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
for (int i=0; i<n; i++) {
cin>>s;
m[s]++;
}
for (int i='1'; i<='5'; i++) {
for (int j='A'; j<='C'; j++) {
s=i;
s+=j;
if (m[s]==0 || i=='5' && m[s]==1) czy=1;
}
}
if (czy) cout<<"NIE";
else cout<<"TAK";
}
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 | #include <iostream> #include <map> using namespace std; int n; bool czy; map<string,int> m; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for (int i=0; i<n; i++) { cin>>s; m[s]++; } for (int i='1'; i<='5'; i++) { for (int j='A'; j<='C'; j++) { s=i; s+=j; if (m[s]==0 || i=='5' && m[s]==1) czy=1; } } if (czy) cout<<"NIE"; else cout<<"TAK"; } |
English