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 ...
随机推荐
- hdu-3549 Flow Problem---最大流模板题(dinic算法模板)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=3549 题目大意: 给有向图,求1-n的最大流 解题思路: 直接套模板,注意有重边 传送门:网络流入门 ...
- 【BZOJ4698】[SDOI2008] Sandy的卡片(后缀数组+二分)
点此看题面 大致题意: 给你\(N\)个序列,若定义两个相同子串为一个子串内所有数加上一个数后能变成另一个串,求所有序列中的最长相同子串的长度. 简单的转化 首先,我们对题目进行一个简单的转化. 要求 ...
- python_45_目录编程
#获取当前目录 import os print(os.getcwd()) #获取目录内容 import os print(os.listdir('C:\\Python27')) #创建目录 impor ...
- python基础一 day17 作业
# 3.用map来处理字符串列表,把列表中所有人都变成sb,比方alex_sbname=['alex','wupeiqi','yuanhao','nezha']# def func(item):# r ...
- python查看安装包
D:\Python27\Scripts>pip listbackports.ssl-match-hostname (3.4.0.2)basicauth (0.2)certifi (14.5.14 ...
- MyISAM 和 InnoDB 的区别与优化
MyISAM 和 InnoDB 的基本区别 1.InnoDB不支持FULLTEXT类型的索引. 2.InnoDB 中不保存表的具体行数,也就是说,执行select count(*) from tabl ...
- Java第六次作业:RuPengGame setGameSize setGameTitle alert loadBgView playSound pause closeSound confirm input createText setTextPosition setTextColor setTextFontSize hideText showText CreateImage(number)
package com.swift; import java.awt.Color; import com.rupeng.game.GameCore;//导入游戏引擎包 //实现Runnable接口 p ...
- Linux常用关机重启命令
# shutdown -h 10 //计算机将在10分钟后 关机,且会显示在登录用户的当前屏幕中 # shutdown -h now //立即 关机 # shutdown -h 20 ...
- 5-3 time模块
1.取当前时间戳和当前格式化时间 import time1 # 以时间戳的形式打印当前时间 1543849862 print(int(time.time()))#时间戳 # 取当前格式化好的时间 20 ...
- 通用后台管理系统源码,响应式布局,Java管理系统源码,零门槛安装部署
本项目是一个通用响应式管理后台,导入开发环境安装就能直接运行,界面也非诚漂亮,在PC端和移动端也是自适应的.非常适合企业或者个人搭建各种商城后台,博客后台,网站管理后台等. 源码启动后的截图 需要这套 ...