#include <map> #include <stdio.h> int main() { int n; scanf("%d", &n); char data[10]; std::map<std::string, int> map; for (int i = 0; i < n; ++i) { scanf("%s", data); map[std::string(data)] += 1; } auto f = [&map](std::string key) { return map[key]; }; bool result = true; result &= f("1A") >= 1 && f("1B") >= 1 && f("1C") >= 1; result &= f("2A") >= 1 && f("2B") >= 1 && f("2C") >= 1; result &= f("3A") >= 1 && f("3B") >= 1 && f("3C") >= 1; result &= f("4A") >= 1 && f("4B") >= 1 && f("4C") >= 1; result &= f("5A") >= 2 && f("5B") >= 2 && f("5C") >= 2; if (result) printf("TAK\n"); else printf("NIE\n"); 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 <map> #include <stdio.h> int main() { int n; scanf("%d", &n); char data[10]; std::map<std::string, int> map; for (int i = 0; i < n; ++i) { scanf("%s", data); map[std::string(data)] += 1; } auto f = [&map](std::string key) { return map[key]; }; bool result = true; result &= f("1A") >= 1 && f("1B") >= 1 && f("1C") >= 1; result &= f("2A") >= 1 && f("2B") >= 1 && f("2C") >= 1; result &= f("3A") >= 1 && f("3B") >= 1 && f("3C") >= 1; result &= f("4A") >= 1 && f("4B") >= 1 && f("4C") >= 1; result &= f("5A") >= 2 && f("5B") >= 2 && f("5C") >= 2; if (result) printf("TAK\n"); else printf("NIE\n"); return 0; } |