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 .

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

问题描述

在一个班里有一些学生,可以帮助教师发现学生最高。

输入

在某些情况下。第一行包含一个整数T,表示例;每一种情况下有一个整数N(1≤N 100,N≤)遵循学生的身高。

输出

对于每一种情况下输出的最高高度,高度保留2位小数;

#include<stdio.h>

main()

{

float a,b,x[1000];

int i,j,n,k;

scanf("%d",&n);

while(n--)

{

scanf("%d",&k);

for(i=0;i<k;i++)

scanf("%f",&x[i]);

b=x[0];

for(i=0;i<k;i++)

if(b<x[i])

b=x[i];

printf("%.2f\n",b);

}

return 0;

}

时间: 2024-08-09 19:14:09

Max Num(最大数)的相关文章

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

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

保留最大数

def solve(num): tmp = num.index(max(num)) if tmp==0: del num[num.index(min(num[1:]))] else: del num[num.index(min(num[:tmp]))] while True: li = raw_input() if li: n, m = map(lambda x:int(x), li.split()) num=list(str(n)) # print num for i in xrange(1,

一维数组的增加,删除,找最大数

1,数组的增加 1 package shuzu; 2 3 public class Shuzu { 4 5 public int[] insertOneNum(int num[], int pos, int nums) { 6 int[] numE = new int[num.length + 1]; 7 for (int i = 0; i < pos; i++) { 8 numE[i] = num[i]; 9 } 10 11 numE[pos] = nums; 12 13 for(int i

NOYJ——寻找最大数

1)题目:寻找最大数 请在整数 n 中删除m个数字, 使得余下的数字按原次序组成的新数最大,比如当n=92081346718538,m=10时,则新的最大数是9888输入第一行输入一个正整数T,表示有T组测试数据 输入 每组测试数据占一行,每行有两个数n,m(n可能是一个很大的整数,但其位数不超过100位,并且保证数据首位非0,m小于整数n的位数) 输出 每组测试数据的输出占一行,输出剩余的数字按原次序组成的最大新数 样例输入 2 92081346718538 10 1008908 5 样例输出

贪心----寻找最大数

#include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> using namespace std; int main() {  int ncase;  char s[110], ans[110];  int m, len, sign, max, num;  scanf("%d", &ncase);

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

求最大数,最小数

package my;public class MyJava {        public static void main(String[] args) {        // TODO Auto-generated method stub        int[] num = {10,5,13,22,87,44};        int max = num[0];        int min = num[0];        for (int i = 1; i < num.length;

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