#include <bits/stdc++.h>
using namespace std;
int tab[7][4];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
for(int i=0;i<n;i++) {
string a;
cin >> a;
tab[a[0]-'0'][a[1]-'A']++;
}
bool result = true;
for(int i=1;i<5;i++)
if(!tab[i][0] or !tab[i][1] or !tab[i][2])
result = false;
if(tab[5][0]<2 or tab[5][1]<2 or tab[5][2]<2)
result = false;
if(result)
cout << "TAK\n";
else
cout << "NIE\n";
}
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 <bits/stdc++.h> using namespace std; int tab[7][4]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; for(int i=0;i<n;i++) { string a; cin >> a; tab[a[0]-'0'][a[1]-'A']++; } bool result = true; for(int i=1;i<5;i++) if(!tab[i][0] or !tab[i][1] or !tab[i][2]) result = false; if(tab[5][0]<2 or tab[5][1]<2 or tab[5][2]<2) result = false; if(result) cout << "TAK\n"; else cout << "NIE\n"; } |
English