#include <stdio.h> int inx(char* str) { return (str[0]-'1')*3 + str[1]-'A'; } int main() { char str[3]; int n,N,Z[15],f; scanf("%d",&N); for (n = 0; n < 15; n++) Z[n] = 0; for (n = 0; n < N; n++) { scanf("%s",str); // printf("%s %d\n",str,inx(str)); Z[inx(str)]++; } f = 1; for (n = 0; n < 15; n++) { // printf("%d ",Z[n]); if (n < 12 && Z[n] < 1) f = 0; if (n >= 12 && Z[n] < 2) f = 0; } printf("%s\n",(f==0)?"NIE":"TAK"); 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 inx(char* str) { return (str[0]-'1')*3 + str[1]-'A'; } int main() { char str[3]; int n,N,Z[15],f; scanf("%d",&N); for (n = 0; n < 15; n++) Z[n] = 0; for (n = 0; n < N; n++) { scanf("%s",str); // printf("%s %d\n",str,inx(str)); Z[inx(str)]++; } f = 1; for (n = 0; n < 15; n++) { // printf("%d ",Z[n]); if (n < 12 && Z[n] < 1) f = 0; if (n >= 12 && Z[n] < 2) f = 0; } printf("%s\n",(f==0)?"NIE":"TAK"); return 0; } |