1199: 零起点学算法106——Max Num

ゞ 浴缸里的玫瑰 2022-10-26 14:10 256阅读 0赞

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 5f8f312f51791b8bb0ed0ae07c2ffa43.gif

  1. 2
  2. 3 170.00 165.00 180.00
  3. 4 165.00 182.00 172.00 160.00

Sample Output

  1. 180.00
  2. 182.00

Source

零起点学算法

Code

  1. #include<iostream>
  2. #include<stdio.h>
  3. using namespace std;
  4. int main()
  5. {
  6. int t;
  7. cin>>t;
  8. while(t--)
  9. {
  10. int n;
  11. cin>>n;
  12. float height[530];
  13. float h=0;
  14. for(int i=1;i<=n;i++)
  15. {
  16. cin>>height[i];
  17. if(height[i]>h)
  18. h=height[i];
  19. }
  20. printf("%.2f\n",h);
  21. }
  22. }

发表评论

表情:
评论列表 (有 0 条评论,256人围观)

还没有评论,来说两句吧...

相关阅读