#include <iostream> using namespace std; void check(int n){ int i = 0; int x; bool check; char b; int a[15] = {0}; while(n-- > 0){ cin >> x >> b >> skipws; a[(x-1)*3 + b - 65]++; } for(;i<12;i++){ if(a[i] == 0){ cout << "NIE"; return; } } for(;i<15;i++){ if(a[i] < 2){ cout << "NIE"; return; } } cout << "TAK"; } int main(){ int n; cin >> n; check(n); 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 27 28 29 30 31 32 33 | #include <iostream> using namespace std; void check(int n){ int i = 0; int x; bool check; char b; int a[15] = {0}; while(n-- > 0){ cin >> x >> b >> skipws; a[(x-1)*3 + b - 65]++; } for(;i<12;i++){ if(a[i] == 0){ cout << "NIE"; return; } } for(;i<15;i++){ if(a[i] < 2){ cout << "NIE"; return; } } cout << "TAK"; } int main(){ int n; cin >> n; check(n); return 0; } |