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 ...
随机推荐
- PHP中MySQL数据库连接,数据读写,修改方法
MySQL连接大的来说有两种方法,一种是mysqli,另一种是mysql.php为连接MySQL提供了函数库,有mysql和mysqli,mysqli是mysql函数库的扩展,是php5才支持的.当你 ...
- 让你不再害怕指针——C指针详解(经典,非常详细)
http://blog.csdn.net/soonfly/article/details/51131141 前言:复杂类型说明 要了解指针,多多少少会出现一些比较复杂的类型,所以我先介绍一下如何完全理 ...
- vue安装环境
vue安装环境 1. 安装node.js 先在电脑上安装node.js, https://nodejs.org/en/ 可以点击链接安装. 安装成功后,在命令板里检测是否安装成功, node -v 2 ...
- Linux 开启关闭防火墙
开放防火墙端口添加需要监听的端口 /sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT/sbin/iptables -I INPUT -p tcp ...
- 【转帖】Linux mount 域控权限的共享目录
https://www.linuxidc.com/Linux/2012-09/71388.htm 之前一直以为没法 映射 home 域的内容 其实还有一个地方.. 注意 空格的话 需要用 \ 进行转移 ...
- shell脚本中case的用法
shell脚本中case选择语句可以结合read指令实现比较好的交互应答操作,case接收到read指令传入的一个或多个参数,然后case根据参数做选择操作. case的语法如下 case $char ...
- DDOS与DOS的区别
0x01 在说之前,先看一些例子吧 还有众所周知的中美黑客大战,新闻我就不说了 0x02 什么是DOS DoS是Denial of Service的简称,即拒绝服务,造成DoS的攻击行为被称为DoS攻 ...
- 文档对象模型 DOM
1 DOM概述 1.1 什么是DOM 文档对象模型 Document Object Model 文档对象模型 是表示和操作 HTML和XML文档内容的基础API 文档对象模型,是W3C组织推荐的处理可 ...
- 洛谷 P2279 [HNOI2003]消防局的设立
题目描述 2020年,人类在火星上建立了一个庞大的基地群,总共有n个基地.起初为了节约材料,人类只修建了n-1条道路来连接这些基地,并且每两个基地都能够通过道路到达,所以所有的基地形成了一个巨大的树状 ...
- Python9-MySQL索引-外键-day43
1.以ATM引出DBMS2.MySQL -服务端 -客户端3.通信交流 -授权 -SQL语句 -数据库 create database db1 default charset=utf8; drop d ...