admin管理员组

文章数量:1550528

杭电ACM第2017题用Java实现

  1. 问题描述

    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

      解析题意:输入一个数字,就有几组数,假如输入的是2,那么就应该有两组 
  数据,输入每组数据之前要表明这组数有几个数,比如输入3 ,后面就得有三个
  数,以此类推。
   例如给出的样例:
   2(两组数据)
  3(第一组数据的个数) 170.00 165.00 180.00
  4 (第二组数据的个数)165.00 182.00 172.00 160.00


 解题思路:
把第一组第二组的数据存入数组,通过数组来比较,判断最大值,for循环的使用
import java.util.*;
public class 

本文标签: ACM杭电Java题用