#include <iostream> constexpr int TASKS_NUM = 5; int main() { int n; int ideas[TASKS_NUM][3] = {0}; std::cin >> n; for (int i = 0; i < n; ++i) { int num; char level; std::cin >> num >> level; ++ideas[num - 1][level - 'A']; } bool answer = true; for (int i = 0; i < TASKS_NUM - 1; ++i) { if (ideas[i][0] == 0 or ideas[i][1] == 0 or ideas[i][2] == 0) { answer = false; break; } } if (ideas[TASKS_NUM - 1][0] < 2 or ideas[TASKS_NUM - 1][1] < 2 or ideas[TASKS_NUM - 1][2] < 2) { answer = false; } std::cout << (answer ? "TAK" : "NIE") << std::endl; 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 | #include <iostream> constexpr int TASKS_NUM = 5; int main() { int n; int ideas[TASKS_NUM][3] = {0}; std::cin >> n; for (int i = 0; i < n; ++i) { int num; char level; std::cin >> num >> level; ++ideas[num - 1][level - 'A']; } bool answer = true; for (int i = 0; i < TASKS_NUM - 1; ++i) { if (ideas[i][0] == 0 or ideas[i][1] == 0 or ideas[i][2] == 0) { answer = false; break; } } if (ideas[TASKS_NUM - 1][0] < 2 or ideas[TASKS_NUM - 1][1] < 2 or ideas[TASKS_NUM - 1][2] < 2) { answer = false; } std::cout << (answer ? "TAK" : "NIE") << std::endl; return 0; } |