HDOJ 2071 Max Num

简介: HDOJ 2071 Max Num

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


image.png

image.png


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

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();
            }
    }
}


目录
相关文章
|
API 开发者
HarmonyOS学习路之开发篇—设备管理(控制类小器件)
控制类小器件指的是设备上的LED灯和振动器。其中,LED灯主要用作指示(如充电状态)、闪烁功能(如三色灯)等;振动器主要用于闹钟、开关机振动、来电振动等场景。
|
机器学习/深度学习 PyTorch 算法框架/工具
使用PyTorch构建GAN生成对抗网络源码(详细步骤讲解+注释版)02 人脸识别 下
使用PyTorch构建GAN生成对抗网络源码(详细步骤讲解+注释版)02 人脸识别 下
|
11天前
|
人工智能 JSON 供应链
畅用7个月无影 JVS Claw |手把手教你把JVS改造成「科研与产业地理情报可视化大师」
LucianaiB分享零成本畅用JVS Claw教程(学生认证享7个月使用权),并开源GeoMind项目——将JVS改造为科研与产业地理情报可视化AI助手,支持飞书文档解析、地理编码与腾讯地图可视化,助力产业关系图谱构建。
23461 10
畅用7个月无影 JVS Claw |手把手教你把JVS改造成「科研与产业地理情报可视化大师」
|
15天前
|
人工智能 缓存 BI
Claude Code + DeepSeek V4-Pro 真实评测:除了贵,没别的毛病
JeecgBoot AI专题研究 把 Claude Code 接入 DeepSeek V4Pro,跑完 Skills —— OA 审批、大屏、报表、部署 5 大实战场景后的真实体验 ![](https://oscimg.oschina.net/oscnet/up608d34aeb6bafc47f
4993 17
Claude Code + DeepSeek V4-Pro 真实评测:除了贵,没别的毛病
|
16天前
|
人工智能 JSON BI
DeepSeek V4 来了!超越 Claude Sonnet 4.5,赶紧对接 Claude Code 体验一把
JeecgBoot AI专题研究 把 Claude Code 接入 DeepSeek V4Pro 的真实体验与避坑记录 本文记录我将 Claude Code 对接 DeepSeek 最新模型(V4Pro)后的真实体验,测试了 Skills 自动化查询和积木报表 AI 建表两个场景——有惊喜,也踩
5979 14