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