Faster, Higher, Stronger

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2970

View Code
 1 #include<stdio.h>
 2 #include<string.h>
 3 int main()
 4 {
 5     char s[20] ;
 6     int t, i, n, a[2010] ;
 7     scanf("%d", &t) ;
 8     while(t--)
 9     {
10         scanf("%s", s) ;
11         scanf("%d", &n) ;
12         for(i=0; i<n; i++)
13         scanf("%d", &a[i]) ;
14         int m = a[0] ;
15         if(strcmp(s, "Faster")==0)
16         {
17             for(i=1; i<n; i++)
18             if(a[i]<m)
19             m = a[i] ;
20         }
21         else
22         {
23             for(i=1; i<n; i++)
24             if(a[i]>m)
25             m = a[i] ;
26         }
27         printf("%d\n", m) ;
28     }
29     return 0 ;
30 }
原文地址:https://www.cnblogs.com/yelan/p/2963717.html