hdu 4176
Class Statistics
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 233 Accepted Submission(s): 153
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 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.
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.
5 30 25 76 23 78
6 25 50 70 99 70 90
Max 78, Min 23, Largest gap 46
Class 2
Max 99, Min 25, Largest gap 25
#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的更多相关文章
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
- HDU 1796How many integers can you find(容斥原理)
How many integers can you find Time Limit:5000MS Memory Limit:32768KB 64bit IO Format:%I64d ...
- hdu 4481 Time travel(高斯求期望)(转)
(转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...
- HDU 3791二叉搜索树解题(解题报告)
1.题目地址: http://acm.hdu.edu.cn/showproblem.php?pid=3791 2.参考解题 http://blog.csdn.net/u013447865/articl ...
随机推荐
- javascript:理解try...catch...finally
以前,我一直喜欢用console.log(do some thing)去执行输出的类型和值,想马上看到弹出的信息,就会直接在浏览器alert()一下,这些是基础知识. 稍微复杂一点点,就要用到判断语句 ...
- IOS 获取文本焦点 主动召唤出键盘(becomeFirstResponder) and 失去焦点(退下键盘)
主动召唤出键盘 - (void)viewDidAppear:(BOOL)animated { // 3.主动召唤出键盘 [self.nameField becomeFirstResponder]; / ...
- fdisk - Linux分区表操作工具软件
总览 fdisk [-u]设备名 fdisk -l [-u] [设备名 ...] fdisk -s分区 ... fdisk -v 描述 硬盘可以被分成一个或多个逻辑磁盘,称为 分区. 这些分区信息都存 ...
- Web开发中,用到的4种会话跟踪技术
会话跟踪:主要解决HTTP的无状态问题,即: 当用户发出请求时,服务器就会做出响应,客户端与服务器之间的联系是离散的.非连续的.当用户在同一网站的多个页面之间转换时,根本无法确定是否是同一个客户,会话 ...
- C#的接口基础教程之四 访问接口
对接口成员的访问 对接口方法的调用和采用索引指示器访问的规则与类中的情况也是相同的.如果底层成员的命名与继承而来的高层成员一致,那么底层成员将覆盖同名的高层成员.但由于接口支持多继承,在多继承中,如果 ...
- (83)zabbix Less than 25% free in the configuration cache解决
在zabbix server默认配置下,出现告警:Less than 25% free in the configuration cache,字面意思是:可用的配置缓存少于25%. 报错如下图: 增加 ...
- js动态刷新时间
<script type="text/javascript"> //取得系统当前时间 function getTime(){ var myDate = new Date ...
- 六、Linux 文件基本属性
Linux 文件基本属性 Linux系统是一种典型的多用户系统,不同的用户处于不同的地位,拥有不同的权限.为了保护系统的安全性,Linux系统对不同的用户访问同一文件(包括目录文件)的权限做了不同的规 ...
- 网站动态加载JS脚本
Demo_1 function loadJS(url, fn) { var ss = document.getElementsByName('script'), loaded = false; for ...
- 作业hashlib题目
'''1.编写用户认证功能,要求如下 1.1.对用户密码加盐处理 1.2.用户名与密文密码存成字典,是以json格式存到文件中的 1.3.要求密用户输入明文密码,但程序中验证的是密文'''import ...