#include <stdio.h> int main() { int n; scanf("%d", &n); int *tabA = new int[5]; int *tabB = new int[5]; int *tabC = new int[5]; int curr; char currc; for(int i = 0; i<n; i++){ scanf("%d%c", &curr, &currc); curr--; switch(currc) { case 'A': tabA[curr]+=1; break; case 'B': tabB[curr]+=1; break; case 'C': tabC[curr]+=1; break; } } for(int i = 0; i<4;i++) { if(tabA[i]<1 || tabB[i]<1 || tabC[i]<1) { printf("NIE\n"); return 0; } } if(tabA[4]<2 || tabB[4]<2 || tabC[4]<2) { printf("NIE\n"); return 0; } printf("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 33 34 35 36 37 38 39 40 | #include <stdio.h> int main() { int n; scanf("%d", &n); int *tabA = new int[5]; int *tabB = new int[5]; int *tabC = new int[5]; int curr; char currc; for(int i = 0; i<n; i++){ scanf("%d%c", &curr, &currc); curr--; switch(currc) { case 'A': tabA[curr]+=1; break; case 'B': tabB[curr]+=1; break; case 'C': tabC[curr]+=1; break; } } for(int i = 0; i<4;i++) { if(tabA[i]<1 || tabB[i]<1 || tabC[i]<1) { printf("NIE\n"); return 0; } } if(tabA[4]<2 || tabB[4]<2 || tabC[4]<2) { printf("NIE\n"); return 0; } printf("TAK"); return 0; } |