#include <iostream> #include <map> #include <string> using namespace std; int n; string s; map<string, int> cnt; int main() { cin >> n; while (n--) { cin >> s; cnt[s]++; } bool fail = false; for (char r='1'; r<='5'; r++) { for (char c='A'; c<='C'; c++) { string x = ""; x += r; x += c; if (cnt[x] < (r == '5' ? 2 : 1)) fail = true; } } cout << (fail ? "NIE\n" : "TAK\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 | #include <iostream> #include <map> #include <string> using namespace std; int n; string s; map<string, int> cnt; int main() { cin >> n; while (n--) { cin >> s; cnt[s]++; } bool fail = false; for (char r='1'; r<='5'; r++) { for (char c='A'; c<='C'; c++) { string x = ""; x += r; x += c; if (cnt[x] < (r == '5' ? 2 : 1)) fail = true; } } cout << (fail ? "NIE\n" : "TAK\n"); return 0; } |