#include <iostream> #include <string> int main() { unsigned excerise_counter[5][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; unsigned n; std::cin >> n; for (unsigned i = 0; i < n; i++) { std::string excerise; std::cin >> excerise; excerise_counter[excerise[0] - '1'][excerise[1] - 'A']++; } for (unsigned i = 0; i < 5; i++) for (unsigned j = 0; j < 3; j++) { if (i == 4) { if (excerise_counter[i][j] < 2) { std::cout << "NIE"; return 0; } } else if (excerise_counter[i][j] < 1) { 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 | #include <iostream> #include <string> int main() { unsigned excerise_counter[5][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}; unsigned n; std::cin >> n; for (unsigned i = 0; i < n; i++) { std::string excerise; std::cin >> excerise; excerise_counter[excerise[0] - '1'][excerise[1] - 'A']++; } for (unsigned i = 0; i < 5; i++) for (unsigned j = 0; j < 3; j++) { if (i == 4) { if (excerise_counter[i][j] < 2) { std::cout << "NIE"; return 0; } } else if (excerise_counter[i][j] < 1) { std::cout << "NIE"; return 0; } } std::cout << "TAK"; return 0; } |