#include <iostream> using namespace std; int code[20] = {}; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { char ch[3]; scanf("%s ", ch); int ind = 3 * (ch[0] - '1') + (ch[1] - 'A'); code [ind]++; // printf("%d:%d\n", ind, code[ind]); } bool ret = true; for (int z = 0; z < 15; z++) { int thres = z < 12 ? 1 : 2; // printf("%d:%d\n ", z, code[z]); if (code[z] < thres) ret = false; } if (ret) 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 28 29 30 31 32 33 34 35 36 37 | #include <iostream> using namespace std; int code[20] = {}; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { char ch[3]; scanf("%s ", ch); int ind = 3 * (ch[0] - '1') + (ch[1] - 'A'); code [ind]++; // printf("%d:%d\n", ind, code[ind]); } bool ret = true; for (int z = 0; z < 15; z++) { int thres = z < 12 ? 1 : 2; // printf("%d:%d\n ", z, code[z]); if (code[z] < thres) ret = false; } if (ret) printf("TAK\n"); else printf("NIE\n"); return 0; } |