#include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin>>n;
vector<vector<int>> tab(3, vector<int>(5));
while(n--){
char a, b; cin>>a>>b;
tab[b-'A'][a-'1']++;
}
bool pos = true;
for(int i = 0; i < 4; i++){
for(int j = 0; j < 3; j++){
if(tab[j][i]<1) pos = false;
}
}
for(int j = 0; j < 3; j++){
if(tab[j][4]<2) pos = false;
}
cout<<(pos?"TAK":"NIE");
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; vector<vector<int>> tab(3, vector<int>(5)); while(n--){ char a, b; cin>>a>>b; tab[b-'A'][a-'1']++; } bool pos = true; for(int i = 0; i < 4; i++){ for(int j = 0; j < 3; j++){ if(tab[j][i]<1) pos = false; } } for(int j = 0; j < 3; j++){ if(tab[j][4]<2) pos = false; } cout<<(pos?"TAK":"NIE"); } |
English