#include <iostream> #include <unordered_map> int main() { std::unordered_map<std::string, int> counts; int c; std::cin >> c; for (int i = 0; i < c; ++i) { std::string w; std::cin >> w; counts[w]++; } bool valid = counts.size() == 15 && counts["5A"] >= 2 && counts["5B"] >= 2 && counts["5C"] >= 2; std::cout << (valid ? "TAK" : "NIE") << std::endl; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream> #include <unordered_map> int main() { std::unordered_map<std::string, int> counts; int c; std::cin >> c; for (int i = 0; i < c; ++i) { std::string w; std::cin >> w; counts[w]++; } bool valid = counts.size() == 15 && counts["5A"] >= 2 && counts["5B"] >= 2 && counts["5C"] >= 2; std::cout << (valid ? "TAK" : "NIE") << std::endl; } |