1199: 零起点学算法106——Max Num
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 ≤ 520 ) , followed n students’ height.
Output
For each case output the highest height, the height to two decimal plases;
" class="reference-link">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
Source
零起点学算法
Code
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
float height[530];
float h=0;
for(int i=1;i<=n;i++)
{
cin>>height[i];
if(height[i]>h)
h=height[i];
}
printf("%.2f\n",h);
}
}
还没有评论,来说两句吧...