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





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

  1. import java.util.Scanner;
  2. public class Main {
  3. static Scanner sc=new Scanner(System.in);
  4. public static void main(String[] args) {
  5. int n=sc.nextInt();
  6. while(n-->0){
  7. int m=sc.nextInt();
  8. double[] a=new double[m];
  9. double max=a[0]=sc.nextDouble();
  10. for(int i=1;i<a.length;i++){
  11. a[i]=sc.nextDouble();
  12. if(max<a[i]){
  13. max=a[i];
  14. }
  15. }
  16. System.out.printf("%.2f",max);
  17. System.out.println();
  18. }
  19. }
  20. }

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. Less 关于css hack的写法

    由于工作需要,最近一直在弄css转写less,遇到最多的问题就是 hack的写法,一些IE的hack,less不支持编译: 常见的不支持的hack如下: IE的滤镜写法 \9\0    IE8部分支持 ...

  2. 前台之boostrap

    这个网址有些东西不错

  3. Registry 类

    提供表示 Windows 注册表中的根项的 RegistryKey 对象,并提供访问项/值对的 static 方法. 继承层次结构 System.Object   Microsoft.Win32.Re ...

  4. maven发布的资源文件到tomcat项目下

    问题:项目中有hibernate的资源文件,src/main/java和src/main/resources都有这些文件,当启动项目时发现出错.但是src/main/java已经修改好了, 经查tom ...

  5. javascript社交平台分享-新浪微博、QQ微博、QQ好友、QQ空间、人人网

    整理的五个社交平台的分享 <!doctype html> <html lang="en"> <head> <meta charset=&q ...

  6. JavaScript Window Screen

    window.screen 对象包含有关用户屏幕的信息. Window Screen window.screen对象在编写时可以不使用 window 这个前缀. 一些属性: screen.availW ...

  7. node-http-proxy修改响应结果

    最近在项目中使用node-http-proxy遇到需要修改代理服务器响应结果需求,该库已提供修改响应格式为html的方案:Harmon,而项目中返回格式统一为json,使用它感觉太笨重了,所以自己写了 ...

  8. asp.net 网站和asp.net Web 应用程序的一处不同

    环境为:VS2008Team+.net3.5 asp.net 网站前台页面<%= %>这样绑定可以,asp.net Web 应用程序就不可以 示例代码如下: 1.asp.net网站 < ...

  9. 【转载】C++应用引用计数技术

    原帖:http://www.cnblogs.com/chain2012/archive/2010/11/12/1875578.html 因为Windows的内核对象也运用了引用计数,所以稍作了解并非无 ...

  10. Perl数组: shift, unshift, push, pop

    pop pop函数会删除并返回数组的最后一个元素. .. ; $fred = pop(@array); # $fred变成9,@array 现在是(5,6,7,8) $barney = pop @ar ...