#include <bits/stdc++.h> using namespace std; bool t[15]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for (int i = 0; i<15; i++) t[i] = 0; int n; string s; cin >> n; bool tak = 1; int pa, pb, pc; pa = pb = pc = 0; for (int i = 0; i<n; i++) { cin >> s; if (s == "5A") pa++; else if (s == "5B") pb++; else if (s == "5C") pc++; //cout << "pb " << pb << "\n"; if (s == "1A") t[0] = 1; else if (s == "1B") t[1] = 1; else if (s == "1C") t[2] = 1; else if (s == "2A") t[3] = 1; else if (s == "2B") t[4] = 1; else if (s == "2C") t[5] = 1; else if (s == "3A") t[6] = 1; else if (s == "3B") t[7] = 1; else if (s == "3C") t[8] = 1; else if (s == "4A") t[9] = 1; else if (s == "4B") t[10] = 1; else if (s == "4C") t[11] = 1; } if (pa >= 2) t[12] = 1; if (pb >= 2) t[13] = 1; if (pc >= 2) t[14] = 1; for (int i = 0; i<15; i++) { if (t[i] == 0) tak = 0; //cout << t[i] << " "; } if (tak == 1) 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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #include <bits/stdc++.h> using namespace std; bool t[15]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for (int i = 0; i<15; i++) t[i] = 0; int n; string s; cin >> n; bool tak = 1; int pa, pb, pc; pa = pb = pc = 0; for (int i = 0; i<n; i++) { cin >> s; if (s == "5A") pa++; else if (s == "5B") pb++; else if (s == "5C") pc++; //cout << "pb " << pb << "\n"; if (s == "1A") t[0] = 1; else if (s == "1B") t[1] = 1; else if (s == "1C") t[2] = 1; else if (s == "2A") t[3] = 1; else if (s == "2B") t[4] = 1; else if (s == "2C") t[5] = 1; else if (s == "3A") t[6] = 1; else if (s == "3B") t[7] = 1; else if (s == "3C") t[8] = 1; else if (s == "4A") t[9] = 1; else if (s == "4B") t[10] = 1; else if (s == "4C") t[11] = 1; } if (pa >= 2) t[12] = 1; if (pb >= 2) t[13] = 1; if (pc >= 2) t[14] = 1; for (int i = 0; i<15; i++) { if (t[i] == 0) tak = 0; //cout << t[i] << " "; } if (tak == 1) cout << "TAK\n"; else cout << "NIE\n"; } |