#include <stdio.h> int main() { int n; int ntasks[5][3] = {}; scanf("%d", &n); while (n--) { char task[3]; scanf("%s", task); ntasks[task[0] - '1'][task[1] - 'A']++; } bool ok = true; for (int j = 0; j < 3; j++) { for (int i = 0; i < 4; i++) if (ntasks[i][j] == 0) ok = false; if (ntasks[4][j] < 2) ok = false; } if (ok) 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 | #include <stdio.h> int main() { int n; int ntasks[5][3] = {}; scanf("%d", &n); while (n--) { char task[3]; scanf("%s", task); ntasks[task[0] - '1'][task[1] - 'A']++; } bool ok = true; for (int j = 0; j < 3; j++) { for (int i = 0; i < 4; i++) if (ntasks[i][j] == 0) ok = false; if (ntasks[4][j] < 2) ok = false; } if (ok) printf("TAK\n"); else printf("NIE\n"); return 0; } |