Class Statistics

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 233    Accepted Submission(s): 153

Problem Description
The
new principal of Woop Woop Public plans to meet the teaching team to
discuss the performance of the classes/teachers and, being a bean
counting fundamentalist, he wants to arm himself with some statistics
for the meetings.
Your task is to write a program that reads the
pupils' marks in each class and generates performance reports for the
principal prior to the meetings.
 
Input
The
input starts with an integer K (1 <= K <= 100) indicating the
number of classes on a line by itself. Each of the following K lines
gives a class's data, which starts with an integer N (2 <= N <=
50) indicating the number of pupils in the class. The number of pupils
is followed by their marks, given as integers, in the range of zero to
one hundred, separated by single spaces.
 
Output
The report for each class consists of two lines.
The first line consists of the sentence: "Class X", where X indicates the class number starting with the value of one.
The
second line reports the maximum class mark, minimum class mark and the
largest difference between consecutive marks (when sorted in
non-decreasing order) in the class using the formats shown in the sample
below.
 
Sample Input
2
5 30 25 76 23 78
6 25 50 70 99 70 90
 
Sample Output
Class 1
Max 78, Min 23, Largest gap 46
Class 2
Max 99, Min 25, Largest gap 25
 
Source
 
Recommend
lcy   |   We have carefully selected several similar problems for you:  4178 4177 4179 4180 4181
 
#include<stdio.h>
#include<string.h>
#include<math.h>
#include<iostream>
#include<algorithm>
using namespace std;
int a[];
int main(){
int t;
scanf("%d",&t);
int cnt=;
while(t--){
int n;
cnt++;
memset(a,,sizeof(a));
scanf("%d",&n);
int temp=-,temp1;
for(int i=;i<n;i++){
scanf("%d",&a[i]); }
sort(a,a+n);
for(int i=;i<n;i++){ temp1=a[i]-a[i-];
if(temp1>temp)
temp=temp1;
}
printf("Class %d\n",cnt);
printf("Max %d, Min %d, Largest gap %d\n",a[n-],a[],temp); } return ;
}

hdu 4176的更多相关文章

  1. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  2. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  3. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  4. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  5. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  6. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  7. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  8. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

  9. HDU 3791二叉搜索树解题(解题报告)

    1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...

随机推荐

  1. hdu-3371 Connect the Cities---kruskal

    题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3371 题目大意: 给n个城市,m条路,k组已知路,求最小费用联通所有城市: 解题思路: kruska ...

  2. ARM体系结构与编程-3

    ARM存储系统:ARM中用于存储管理的系统控制协处理器CP15:包括16个32位寄存器,其编号为0到15.实际上对于某些编号的寄存器可能相应有多个物理寄存器. 訪问CP15寄存器的指令:MRC.MCR ...

  3. 问题 M: 克隆玩具

    题目描述 你只有一个A类型玩具,现在有个有两种功能的机器:1. 加工一个A类型的玩具能够再得到一个A类型的玩具和一个B类型的玩具.2. 加工一个B类型的玩具,能得到两个B类型的玩具. 问经过多次加工之 ...

  4. Quartz 配置文件属性

    主要配置 Property Name Req'd Type Default Value org.quartz.scheduler.instanceName no string 'QuartzSched ...

  5. java调用摄像头

    http://blog.csdn.net/xing_sky/article/details/43482213 原文地址:http://blog.csdn.net/zajin/article/detai ...

  6. python-的多线程处理

    书到用时方恨少,这句话在软件杯真的深深体会到了.但是对自己对于代码的领会能力还是有自信的,在做项目的时候用到了多线程的处理,开始都不知道该怎么去百度搜索关键词

  7. Cannot read property 'tap' of undefined

    E:\vue-project\vue-element-admin-master>npm run build:prod vue-element-admin@3.8.1 build:prod E:\ ...

  8. sendmail安装与配置

    一.安装sendmail与mail 1.安装sendmail:  1) centos下可以安装命令:yum -y install sendmail 2) 安装完后启动sendmail命令:servic ...

  9. python 时间加8小时后的时间

    eta_temp = one['arrival'].encode('utf-8') fd = datetime.datetime.strptime(eta_temp, "%Y-%m-%dT% ...

  10. pymysql模块操作数据库及连接报错解决方法

    import pymysql sql = "select host,user,password from user" #想要执行的MySQL语句 #sql = 'create da ...