#include <stdio.h>
#include <stdlib.h>
using namespace std;
int main() {
int n, curr, x, y, left = 18;
int zad[3][5] = {{1,1,1,1,2},{1,1,1,1,2},{1,1,1,1,2}};
scanf("%d", &n);
if(n < 18) {
printf("NIE");
return 0;
}
for(int i=0; i < n; i++) {
scanf("%x", &curr);
x = (curr % 16) - 10;
y = (curr / 16) - 1;
zad[x][y]--;
if(zad[x][y] >= 0) {
left -= 1;
if(left == 0) {
printf("TAK");
return 0;
}
}
// if(n-i-1 < left) {
// printf("NIE");
// return 0;
// }
}
printf("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 30 31 32 33 34 35 36 37 | #include <stdio.h> #include <stdlib.h> using namespace std; int main() { int n, curr, x, y, left = 18; int zad[3][5] = {{1,1,1,1,2},{1,1,1,1,2},{1,1,1,1,2}}; scanf("%d", &n); if(n < 18) { printf("NIE"); return 0; } for(int i=0; i < n; i++) { scanf("%x", &curr); x = (curr % 16) - 10; y = (curr / 16) - 1; zad[x][y]--; if(zad[x][y] >= 0) { left -= 1; if(left == 0) { printf("TAK"); return 0; } } // if(n-i-1 < left) { // printf("NIE"); // return 0; // } } printf("NIE"); return 0; } |
English