Max Num---hdu2071

Max Num

Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 16818    Accepted Submission(s): 10381

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 #include<stdio.h>
 2 int main()
 3 {
 4     int n,a,i,j;
 5     double s[101],max;
 6     scanf("%d",&n);
 7     while(n--)
 8     {
 9         scanf("%d",&a);
10         for(i=0;i<a;i++)
11         scanf("%lf",&s[i]);
12         max=s[0];
13         for(i=1;i<a;i++)
14         max=max>s[i]?max:s[i];
15         printf("%.2lf\n",max);
16     }
17     return 0;
18 }
时间: 2024-12-19 05:51:26

Max Num---hdu2071的相关文章

HDU2071 Max Num【水题】

Max Num Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 15557    Accepted Submission(s): 9670 Problem Description There are some students in a class, Can you help teacher find the highest stude

nefu 650 max num

题目:经典dp题目,求出最大相邻子序列的和. 方法:给出两种方法,一种dp,一种直接暴力(数据量小的时候可以考虑). 代码1: #include <iostream> #include <cstdio> using namespace std; int main() { int n; int t=1; cin>>n; int s[100010]; while(t<=n) { int m; cin>>m; long long ans=0,sum=0; i

Max Num(最大数)

time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16377    Accepted Submission(s): 10155 Problem Description There are some students in a class, Can you help teacher find the highest student . In

HDOJ-1003 Max Sum(最大连续子段 动态规划)

http://acm.hdu.edu.cn/showproblem.php?pid=1003 给出一个包含n个数字的序列{a1,a2,..,ai,..,an},-1000<=ai<=1000 求最大连续子段和及其起始位置和终止位置,很基础的动态规划(DP)问题,看完DP第一次做的DP题目 DP真的是一种很优美的算法,或者说思想,但是比较难理解,我对DP的理解还很浅薄 # include <stdio.h> # define INF 1000000000 int main() { i

MAX GROUP BY

IF OBJECT_ID('TABMAXID') IS NOT NULL DROP TABLE TABMXID GO CREATE TABLE TABMXID( ID INT IDENTITY(1,1) PRIMARY KEY, NAME VARCHAR(50) NOT NULL, NUM INT NOT NULL ) GO INSERT INTO TABMXID(NAME,NUM)VALUES(1,2) INSERT INTO TABMXID(NAME,NUM)VALUES(1,3) INSE

[ACM] hdu 1003 Max Sum(最大子段和模型)

Max Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 135262    Accepted Submission(s): 31311 Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max s

Max Chunks To Make Sorted II LT768

This question is the same as "Max Chunks to Make Sorted" except the integers of the given array are not necessarily distinct, the input array could be up to length 2000, and the elements could be up to 10**8. Given an array arr of integers (not

Max Chunks To Make Sorted LT769

Given an array arr that is a permutation of [0, 1, ..., arr.length - 1], we split the array into some number of "chunks" (partitions), and individually sort each chunk.  After concatenating them, the result equals the sorted array. What is the m

[转载]SQL语句练习

2.查询"生物"课程比"物理"课程成绩高的所有学生的学号: 思路: 获取所有有生物课程的人(学号,成绩) - 临时表 获取所有有物理课程的人(学号,成绩) - 临时表 根据[学号]连接两个临时表: 学号 物理成绩 生物成绩 然后再进行筛选 select A.student_id,sw,ty from (select student_id,num as sw from score left join course on score.course_id = course