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





同一个代码!这个运行时间正好是在超时的边界!~

import java.util.Scanner;
public class Main { static Scanner sc=new Scanner(System.in);
public static void main(String[] args) {
int n=sc.nextInt();
while(n-->0){
int m=sc.nextInt();
double[] a=new double[m];
double max=a[0]=sc.nextDouble();
for(int i=1;i<a.length;i++){
a[i]=sc.nextDouble();
if(max<a[i]){
max=a[i];
}
}
System.out.printf("%.2f",max);
System.out.println();
} }
}

HDOJ 2071 Max Num的更多相关文章

  1. HDU 2071 Max Num

    http://acm.hdu.edu.cn/showproblem.php?pid=2071 Problem Description There are some students in a clas ...

  2. JSU省赛队员选拔赛个人赛1(Coin Change、Fibbonacci Number、Max Num、单词数、无限的路、叠筐)

    JSU省赛队员选拔赛个人赛1 一.题目概述: A.Coin Change(暴力求解.动态规划)     B.Fibbonacci Number(递推求解) C.Max Num(排序.比较) D.单词数 ...

  3. HDOJ 3415 Max Sum of Max-K-sub-sequence(单调队列)

    因为是circle sequence,可以在序列最后+序列前n项(或前k项);利用前缀和思想,预处理出前i个数的和为sum[i],则i~j的和就为sum[j]-sum[i-1],对于每个j,取最小的s ...

  4. 最大子序列和 HDOJ 1003 Max Sum

    题目传送门 题意:求MCS(最大连续子序列和)及两个端点分析:第一种办法:dp[i] = max (dp[i-1] + a[i], a[i]) 可以不开数组,用一个sum表示前i个数字的MCS,其实是 ...

  5. HDOJ 1024 Max Sum Plus Plus -- 动态规划

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1024 Problem Description Now I think you have got an ...

  6. HDOJ(1003) Max Sum

    写的第一个版本,使用穷举(暴力)的方法,时间复杂度是O(N^2),执行时间超过限制,代码如下: #include <stdio.h> #define MAX_LEN 100000UL in ...

  7. Hdoj 1003.Max Sum 题解

    Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum ...

  8. Max Num

    Problem Description There are some students in a class, Can you help teacher find the highest studen ...

  9. [HDOJ] 2026.Max Sum

    2026.Max Sum (c++) Problem Description Consider the aggregate An= { 1, 2, -, n }. For example, A1={1 ...

随机推荐

  1. EF Lambda 多表查询

    using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mv ...

  2. List<T>取交集、差集、并集

    1.  取交集 (A和B都有) List A : { 1 , 2 , 3 , 5 , 9 }List B : { 4 , 3 , 9 }var intersectedList = list1.Inte ...

  3. 制作SSL证书

    上一节介绍了OpenSSL的目录结构,本节介绍一下SSL证书的制作. OpenSSL安装后建议把其中的bin目录添加到系统环境变量中,方便以后操作. 建立一个新的目录SSL专门用来制作证书. 建立证书 ...

  4. Nhibernate 智能提示 以及其他类库智能提示

    Nhibernate 的智能提示 Nhibernate.dll 放到以下路径 C:\Program Files (x86)\Reference Assemblies\Microsoft\Framewo ...

  5. 2016.7.13final 修饰符使用

    final修饰符可以修饰类.变量.函数: 1.被final所修饰的类不能被继承,函数不能被继承,成员变量不能再次被赋值并且被称为常量: 2.被final 修饰的成员变量 .它通常被static所修饰, ...

  6. 中级Perl第二章习题

    2. 4. 1. 习题1 [15 分钟] 写一个程序从命令行取一个文件清单, 然后用grep 把那些文件大小在1000 字节以内的文件找出来.用map 把这个清单里的每个字串前加四个空格并在 字串后面 ...

  7. 借助Q.js学习javascript异步编程。

    金字塔式 //add1 function step1(n, callback) { setTimeout(function(){ callback.call(null, n + 1); }, 100) ...

  8. 代码bug

    1.webstorm ide未配置basePath本地会加入根路径 2.点击一次就销毁可以给标签设置一个值data-val="0" 某个函数只执行一次的方法,或者也可以考虑绑用on ...

  9. easyui tab 加载iframe 高度问题

    其实按网上搜的结果,easyui 有个data-options属性是fit:true. 加上他之后会使得自适应父类的宽高. 加上之后,发现个问题,当刷新tab内容的时候高度是对的,但是新建tab的时候 ...

  10. eval函数:分号的应用

    eval("echo'hello world';"); ("参数;") eval函数把参数当做php代码来执行,参数后要有分号,最后还要另加一个分号 相当于: ...