#include <cstdio>
using namespace std;
int c[5][3];
int main() {
int n; scanf("%d", &n);
while (n--) {
char s[3]; scanf("%s", s);
++c[s[0] - '1'][s[1] - 'A'];
}
bool ok = true;
for (int i = 0; i < 5; ++i) {
for (int j = 0; j < 3; ++j) {
ok &= (i == 4 ? c[i][j] >= 2 : c[i][j] >= 1);
}
}
puts(ok ? "TAK" : "NIE");
return 0;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <cstdio> using namespace std; int c[5][3]; int main() { int n; scanf("%d", &n); while (n--) { char s[3]; scanf("%s", s); ++c[s[0] - '1'][s[1] - 'A']; } bool ok = true; for (int i = 0; i < 5; ++i) { for (int j = 0; j < 3; ++j) { ok &= (i == 4 ? c[i][j] >= 2 : c[i][j] >= 1); } } puts(ok ? "TAK" : "NIE"); return 0; } |
English