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. 使用strut2要注意的问题

  2. HTML5 autocomplete属性、表单自动完成

    autocomplete属性 1.定义autocomplete属性规范表单是否启用自动完成功能.自动完成允许浏览器对字段的输入,是基于之前输入的值.2.应用范围autocomplete使用<fo ...

  3. Sqlserver通过链接服务器访问Oracle

    工作中遇到的情况,win 7 64位操作系统的就安装64位的oracle 客户端,然后重启sql service服务后再创建sql 链接服务器.关于如何创建链接服务器请查看下面的大神的链接: http ...

  4. StudioStyle 使用 厌倦了默认的Visutal Studio样式了,到这里找一个酷的试试

    厌倦了默认的Visutal Studio样式了,到这里找一个酷的试试 http://studiostyl.es/ 去下载个自己喜欢的编码样式吧 如果你有想法 有能力 可以自己去做一个自己喜欢的  OK ...

  5. [转]Web UI 设计命名规范

    来源:http://blog.bingo929.com/web-ui-design-name-convention.html 一.网站设计及基本框架结构: 1.    Container “conta ...

  6. Hessian(C#)介绍及使用说明

    什么是Hessian? Hessian是Caucho开发的一种二进制Web Service协议.支持目前所有流行的开发平台. Hessia能干什么? hessian用来实现web服务. Hessia有 ...

  7. CI框架多目录设置

    1,设置目的,前台与后台实现独立目录管理 2.通过http://www.myci.com  访问前台,通过http://www.myci.com/admin 访问后台,   多目录的意思是指在同一个网 ...

  8. mem 族函数的实现

    1.void * memcpy ( void * dest, const void * src, size_t num ); 头文件:#include <string.h>memcpy() ...

  9. 赋值,copy和deepcopy

    python的复制,拷贝,和深拷贝. >>> a=[23,3]>>> b=a>>> b.append(234)>>> a[23, ...

  10. PHPMailer发匿名邮件及Extension missing: openssl的解决

    原文链接:http://www.tongfu.info/phpmailer%E5%8F%91%E5%8C%BF%E5%90%8D%E9%82 %AE%E4%BB%B6%E5%8F%8Aextensio ...