#include <iostream> #include <stdio.h> //#define dbg printf #define dbg //printf int count[5][3] = {{0}}; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; int now_task = s[0] - '0' - 1; int now_diw = s[1] - 'A'; // printf("(%d %d)\n", now_task, now_diw); count[now_task][now_diw]++; } for (int task = 0; task < 4; ++task) { for (int diw = 0; diw < 3; ++diw) { dbg("(%d %d) = %d\n", task, diw, count[task][diw]); if (count[task][diw] < 1) { printf("NIE\n"); return 0; } } } for (int diw = 0; diw < 3; ++diw) { dbg("(%d %d) = %d\n", 4, diw, count[4][diw]); if (count[4][diw] < 2) { dbg("(%d %d)\n", 4, diw); 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | #include <iostream> #include <stdio.h> //#define dbg printf #define dbg //printf int count[5][3] = {{0}}; int main() { int n; scanf("%d", &n); for (int i = 0; i < n; ++i) { std::string s; std::cin >> s; int now_task = s[0] - '0' - 1; int now_diw = s[1] - 'A'; // printf("(%d %d)\n", now_task, now_diw); count[now_task][now_diw]++; } for (int task = 0; task < 4; ++task) { for (int diw = 0; diw < 3; ++diw) { dbg("(%d %d) = %d\n", task, diw, count[task][diw]); if (count[task][diw] < 1) { printf("NIE\n"); return 0; } } } for (int diw = 0; diw < 3; ++diw) { dbg("(%d %d) = %d\n", 4, diw, count[4][diw]); if (count[4][diw] < 2) { dbg("(%d %d)\n", 4, diw); printf("NIE\n"); return 0; } } printf("TAK\n"); return 0; } |