|
|
вернуться в форумWA#15. I posted my C code Hi. I've got WA on test 15. Here is my C code: /** * No: 1644 */ #include <stdio.h> #include <conio.h> #include <string.h> int main() { int n, i, a[101][2]={0}, maxs=0, mins=10, maxh=0; char s[15]; scanf("%d", &n); for(i=0; i<n; i++) { scanf("%d%s", &a[i][0], &s); if(strcmp(s, "satisfied") == 0) a[i][1] = 1; }
for(i=0; i<n; i++) if(a[i][1] == 1) { if(maxs < a[i][0]) maxs = a[i][0]; if(mins > a[i][0]) mins = a[i][0]; } else { if(maxh < a[i][0]) maxh = a[i][0]; }
if(maxs==0 && mins==10) printf("10"); else if(maxh >= maxs) printf("Inconsistent"); else { for(i=0; i<n; i++) if(a[i][0] > maxh && a[i][1] == 1 && maxs > a[i][0]) maxs = a[i][0]; printf("%d", maxs); }
return 0; } Edited by author 15.03.2012 16:34 |
|
|