#include <ios> #include <iostream> int main() { std::ios_base::sync_with_stdio(false); unsigned counters[5][3] = {0}; unsigned n; std::cin >> n; for (unsigned i = 0; i < n; ++i) { std::string desc; std::cin >> desc; counters[desc[0] - '1'][desc[1] - 'A'] += 1; } bool ok = true; for (unsigned round = 0; round < 5; ++round) { for (unsigned divi = 0; divi < 3; ++divi) { if (counters[round][divi] < (round == 4 ? 2 : 1)) ok = false; } } if (ok) std::cout << "TAK" << std::endl; else std::cout << "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 28 29 30 31 | #include <ios> #include <iostream> int main() { std::ios_base::sync_with_stdio(false); unsigned counters[5][3] = {0}; unsigned n; std::cin >> n; for (unsigned i = 0; i < n; ++i) { std::string desc; std::cin >> desc; counters[desc[0] - '1'][desc[1] - 'A'] += 1; } bool ok = true; for (unsigned round = 0; round < 5; ++round) { for (unsigned divi = 0; divi < 3; ++divi) { if (counters[round][divi] < (round == 4 ? 2 : 1)) ok = false; } } if (ok) std::cout << "TAK" << std::endl; else std::cout << "NIE" << std::endl; return 0; } |