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 ...
随机推荐
- IBM WebSphere MQ安装及配置详解
打开MQ安装程序,选择下一步,默认安装WebSphere MQ, 完成MQ的安装工作,启动WebSphere MQ, 服务器配置,选择新建队列管理器,创建名为 "mq"的队列管理器 ...
- Windows Phone Emulator 模拟器常用快捷键
在使用Windows Phone 的开发的时候,在目前大家还很难买到真实的Windows Phone 设备的情况下,我们用来调试自己的程序经常用到的可能就是Emulator了.经常会有人问我说,用鼠标 ...
- 【BZOJ1562】[NOI2009] 变换序列(匈牙利算法)
点此看题面 大致题意: 给你一个长度为\(n\)的序列\(D\),让你找到一个字典序最小的\(n\)的排列\(T\),满足\(D_i=min(|T_i-i|,n-|T_i-i|)\). 建图 我想建图 ...
- 一键备份脚本 backup.sh
做网站最重要的是什么?数据!数据,是网站之本,备份,是每一个站长都应该重视的事情.但同时,备份也是一件繁琐和重复的事情.所以,这些事情,肯定能做到自动化的.下面来介绍一下这个一键备份脚本 backup ...
- python 数据库操作 SQLite、MySQL 摘录
转自: http://www.cnblogs.com/windlaughing/p/3157531.html 不管使用什么后台数据库,代码所遵循的过程都是一样的:连接 -> 创建游标 -> ...
- 2017.12.1 如何用java写出一个菱形图案
上机课自己写的代码 两个图形原理都是一样的 1.一共有仨个循环 注意搞清楚每一层循环需要做的事情 2.第一层循环:是用来控制行数 3.第二层循环控制打印空格数 4.第三层循环是用来循环输出星星 imp ...
- jQuery支持链式编程,一句话实现左侧table页+常用筛选器总结
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- javascript的基本类型和引用类型
一.基本类型和引用类型 基本的数据类型有5个:undefined,boolean,number,string,null ? 1 2 3 4 5 typeof null; //"object& ...
- HTTP协议原理
HTTP是一个客户端终端(用户)和服务器端(网站)请求和应答的标准(TCP).通过使用网页浏览器.网络爬虫或者其它的工具,客户端发起一个HTTP请求到服务器上指定端口(默认端口为80).我们称这个客户 ...
- Git 内部原理之 Git 对象哈希
在上一篇文章中,将了数据对象.树对象和提交对象三种Git对象,每种对象会计算出一个hash值.那么,Git是如何计算出Git对象的hash值?本文的内容就是来解答这个问题. Git对象的hash方法 ...