题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2071
题目描述:
Problem Description
There are some students in a class, Can you help teacher find the highest student .
Input
There are some cases. The first line contains an integer t, indicate the cases; Each case have an integer n ( 1 ≤ n ≤ 100 ) , followed n students’ height.
Output
For each case output the highest height, the height to two decimal plases;
Sample Input
2
3 170.00 165.00 180.00
4 165.00 182.00 172.00 160.00
Sample Output
180.00
182.00
1 #include<cstdio> 2 using namespace std; 3 int main() 4 { 5 int n,a; 6 double h[101],max; 7 scanf("%d",&n); 8 while(n--){ 9 scanf("%d",&a); 10 for(int i=0;i<a;i++){ 11 scanf("%lf",&h[i]); 12 } 13 max=h[0]; 14 for(int j=1;j<a;j++){ 15 max=max>h[j]?max:h[j]; 16 } 17 printf("%.2lf ",max); 18 } 19 return 0; 20 }