#include <stdio.h> int main(void) { unsigned short int n,i; unsigned long int t; scanf("%hu", &n); while(n!=0){ scanf("%lu", &t); unsigned long int sizes[t][4], vals[]={0, 0, 0, 0}; for (i=0;i<t;i++){ scanf("%lu %lu %lu %lu", &sizes[i][0], &sizes[i][1], &sizes[i][2], &sizes[i][3]); if(vals[0] == 0 || vals[0] > sizes[i][0]) vals[0] = sizes[i][0]; if(vals[2] == 0 || vals[2] > sizes[i][2]) vals[2] = sizes[i][2]; if(vals[1] == 0 || vals[1] < sizes[i][1]) vals[1] = sizes[i][1]; if(vals[3] == 0 || vals[3] < sizes[i][3]) vals[3] = sizes[i][3]; } char *response = "NIE"; for (i=0;i<t;i++){ if(vals[0] == sizes[i][0] && vals[1] == sizes[i][1] && vals[2] == sizes[i][2] && vals[3] == sizes[i][3]) response = "TAK"; } printf("%s\n", response); n -= 1; } 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 41 42 43 44 | #include <stdio.h> int main(void) { unsigned short int n,i; unsigned long int t; scanf("%hu", &n); while(n!=0){ scanf("%lu", &t); unsigned long int sizes[t][4], vals[]={0, 0, 0, 0}; for (i=0;i<t;i++){ scanf("%lu %lu %lu %lu", &sizes[i][0], &sizes[i][1], &sizes[i][2], &sizes[i][3]); if(vals[0] == 0 || vals[0] > sizes[i][0]) vals[0] = sizes[i][0]; if(vals[2] == 0 || vals[2] > sizes[i][2]) vals[2] = sizes[i][2]; if(vals[1] == 0 || vals[1] < sizes[i][1]) vals[1] = sizes[i][1]; if(vals[3] == 0 || vals[3] < sizes[i][3]) vals[3] = sizes[i][3]; } char *response = "NIE"; for (i=0;i<t;i++){ if(vals[0] == sizes[i][0] && vals[1] == sizes[i][1] && vals[2] == sizes[i][2] && vals[3] == sizes[i][3]) response = "TAK"; } printf("%s\n", response); n -= 1; } return 0; } |