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. 关于NetworkInfo对象的isConnected()与isAvailable()

      public class MainActivity extends Activity{    /** Called when the activity is first created. */   ...

  2. R cannot be resolved to a variable

    1. 检查Android 的SDK是否丢失需要重新下载,检查build path,把需要导入的JAR包确认都导入成功 2. 确保class没有import Android.R,注意是不能有Androi ...

  3. VB中右键换行

    /r/n  能在邮件中进行换行, 在VB中使用 ASCII码的 chr(10).chr(13) 就能使VB发送邮件实现换行

  4. PHPCMS 使用图示和PHPCMS二次开发教程(转)

    PHPCMS V9 核心文件说明 模块与控制器 模块: phpcms v9框架中的模块,位于phpcms/modules目录中 每一个目录称之为一个模块.即url访问中的m. 访问content模块示 ...

  5. MyBatis Generator自动生成MyBatis的映射代码

    MyBatis Generator大大简化了MyBatis的数据库的代码编写,有了一个配置文件,就可以直接根据表映射成实体类.Dao类和xml映射.资源地址:MyBatis项目地址:http://my ...

  6. 织梦dedecms后台发布文章不自动更新首页与栏目列表页

    dedecms发文章不自动更新首页也列表页解决办法如下: 登陆dedecms后台,找到“系统”“系统基本参数”“性能选项”,把“arclist标签调用缓存”设置成0,然后把“发布文章后马上更新网站主页 ...

  7. Yii2的相关学习记录,前后台分离及migrate使用(七)

    最近一直忙其它的(其实是懒!),将<深入理解Yii2>看了一遍,一些当初没明白的稍微明了了点,然后又看yii2的图片上传等处理.富文本.restful什么的,但由于没进行到这里,只看也不管 ...

  8. js 代码记录

    window.screen.availWidth 返回当前屏幕宽度(空白空间) window.screen.availHeight 返回当前屏幕高度(空白空间) window.screen.width ...

  9. STM32学习笔记——定时器中断(向原子哥学习)

    定时器中断 STM32 的定时器功能十分强大,有 TIME1 和 TIME8 等高级定时器,也有 TIME2~TIME5 等通用定时器,还有 TIME6 和TIME7 等基本定时器.在本章中,我们将利 ...

  10. 在Site Settings下找不到Navigation标签

    有时候我们可能找不到Navigation标签, 仅仅在Look and Feel下面看到"Quick launch" 如何才能找到我们想要的"Navigation&quo ...