#include <cstdio> #include <map> int main () { int n; scanf("%d", &n); std::map<int, int> z; for (int i = 0; i < 15; ++i) { z[i] = 0; } for (int i = 0; i < n; ++i) { char c0, c1, c2; scanf("%c%c%c", &c0, &c1, &c2); int x = 3 * (c1 - '1') + (c2 - 'A'); z[x]++; } for (int i = 0; i < 15; ++i) { if ((z[i] == 0) || ((z[i] == 1) && (i >= 12))) { printf("NIE\n"); return 0; } } printf("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 24 25 | #include <cstdio> #include <map> int main () { int n; scanf("%d", &n); std::map<int, int> z; for (int i = 0; i < 15; ++i) { z[i] = 0; } for (int i = 0; i < n; ++i) { char c0, c1, c2; scanf("%c%c%c", &c0, &c1, &c2); int x = 3 * (c1 - '1') + (c2 - 'A'); z[x]++; } for (int i = 0; i < 15; ++i) { if ((z[i] == 0) || ((z[i] == 1) && (i >= 12))) { printf("NIE\n"); return 0; } } printf("TAK\n"); return 0; } |