#include <stdio.h>
#include <stdbool.h>
bool ok(int *t)
{
for (int i = 0; i < 12; i++)
if (t[i] < 1) return false;
for (int i = 12; i < 15; i++)
if (t[i] < 2) return false;
return true;
}
int main()
{
int n;
scanf("%d\n", &n);
int ile[15] = { 0 };
for (int i = 0; i < n; i++)
{
char txt[5];
scanf("%s", txt);
const int nr = (txt[0] - '1') * 3 + txt[1] - 'A';
ile[nr]++;
}
printf(ok(ile) ? "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 22 23 24 25 26 27 28 29 | #include <stdio.h> #include <stdbool.h> bool ok(int *t) { for (int i = 0; i < 12; i++) if (t[i] < 1) return false; for (int i = 12; i < 15; i++) if (t[i] < 2) return false; return true; } int main() { int n; scanf("%d\n", &n); int ile[15] = { 0 }; for (int i = 0; i < n; i++) { char txt[5]; scanf("%s", txt); const int nr = (txt[0] - '1') * 3 + txt[1] - 'A'; ile[nr]++; } printf(ok(ile) ? "TAK" : "NIE"); return 0; } |
English