#include <iostream>
int main() {
int n;
std::string pos;
std::cin >> n;
int tab[15] = {};
for (int i = 0; i < n; i++) {
std::cin >> pos;
if (pos == "1A") {
tab[0]++;
}
if (pos == "1B") {
tab[1]++;
}
if (pos == "1C") {
tab[2]++;
}
if (pos == "2A") {
tab[3]++;
}
if (pos == "2B") {
tab[4]++;
}
if (pos == "2C") {
tab[5]++;
}
if (pos == "3A") {
tab[6]++;
}
if (pos == "3B") {
tab[7]++;
}
if (pos == "3C") {
tab[8]++;
}
if (pos == "4A") {
tab[9]++;
}
if (pos == "4B") {
tab[10]++;
}
if (pos == "4C") {
tab[11]++;
}
if (pos == "5A") {
tab[12]++;
}
if (pos == "5B") {
tab[13]++;
}
if (pos == "5C") {
tab[14]++;
}
}
for (int i = 0; i < 12; i++) {
if (tab[i] == 0) {
std::cout << "NIE";
return 0;
}
}
for (int i = 12; i < 15; i++) {
if (tab[i] < 2) {
std::cout << "NIE";
return 0;
}
}
std::cout << "TAK";
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 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 | #include <iostream> int main() { int n; std::string pos; std::cin >> n; int tab[15] = {}; for (int i = 0; i < n; i++) { std::cin >> pos; if (pos == "1A") { tab[0]++; } if (pos == "1B") { tab[1]++; } if (pos == "1C") { tab[2]++; } if (pos == "2A") { tab[3]++; } if (pos == "2B") { tab[4]++; } if (pos == "2C") { tab[5]++; } if (pos == "3A") { tab[6]++; } if (pos == "3B") { tab[7]++; } if (pos == "3C") { tab[8]++; } if (pos == "4A") { tab[9]++; } if (pos == "4B") { tab[10]++; } if (pos == "4C") { tab[11]++; } if (pos == "5A") { tab[12]++; } if (pos == "5B") { tab[13]++; } if (pos == "5C") { tab[14]++; } } for (int i = 0; i < 12; i++) { if (tab[i] == 0) { std::cout << "NIE"; return 0; } } for (int i = 12; i < 15; i++) { if (tab[i] < 2) { std::cout << "NIE"; return 0; } } std::cout << "TAK"; return 0; } |
English