A - Class Statistics

Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu

Description

 ///最开始 没有读懂  Largest gap坑也~~~    是拍好循序后的  连续最大差

 #include <iostream>
#include <string.h>
#include <stdio.h>
#include <algorithm> using namespace std; int main()
{
int t;
int num;
int n;int a[];
scanf("%d",&t);
for(num=;num<=t;num++)
{
scanf("%d",&n);
for(int i=;i<n;i++)
scanf("%d",&a[i]);
sort(a,a+n);
int sum=;
for(int i=;i<n-;i++)
{
if(sum<(a[i+]-a[i]))
sum=(a[i+]-a[i]);
}
printf("Class %d\n",num);
printf("Max %d, Min %d, Largest gap %d\n",a[n-],a[],sum);
}
return ;
}

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 ( 1K100) 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 ( 2N50) 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

A - Class Statistics的更多相关文章

  1. ABBA BABA statistics

    The ABBA BABA statistics are used to detect and quantify an excess of shared derived alleles, which ...

  2. SQL Server 的 Statistics 簡介

    當你要清空「資料表(table)」,或倒入大量「資料(data;record)」,或公司「資料庫(database)」改用新版本要資料大搬家…等情形,不只是要重建「索引(index)」,還應要重建或更 ...

  3. SP2-0618: 无法找到会话标识符。启用检查 PLUSTRACE 角色 SP2-0611: 启用 STATISTICS 报告时出错

    援引: SP2-0618: 无法找到会话标识符.启用检查 PLUSTRACE 角色 SP2-0611: 启用 STATISTICS 报告时出错 问题描述及解决方法: SQL*Plus: Release ...

  4. Spark MLlib 之 Basic Statistics

    Spark MLlib提供了一些基本的统计学的算法,下面主要说明一下: 1.Summary statistics 对于RDD[Vector]类型,Spark MLlib提供了colStats的统计方法 ...

  5. SQL优化 CREATE STATISTICS

    CREATE STATISTICS 语法: https://msdn.microsoft.com/zh-cn/library/ms188038.aspx STATISTICS优化中的使用案例: htt ...

  6. [转] 利用SET STATISTICS IO和SET STATISTICS TIME 优化SQL Server查询性能

    首先需要说明的是这篇文章的内容并不是如何调节SQL Server查询性能的(有关这方面的内容能写一本书),而是如何在SQL Server查询性能的调节中利用SET STATISTICS IO和SET ...

  7. 性能调优:理解Set Statistics IO输出

    性能调优是DBA的重要工作之一.很多人会带着各种性能上的问题来问我们.我们需要通过SQL Server知识来处理这些问题.经常被问到的一个问题是:早上这个存储过程运行时间还是可以的,但到了晚上就很慢很 ...

  8. Stanford机器学习笔记-3.Bayesian statistics and Regularization

    3. Bayesian statistics and Regularization Content 3. Bayesian statistics and Regularization. 3.1 Und ...

  9. SQL Server读懂语句运行的统计信息 SET STATISTICS TIME IO PROFILE ON

    对于语句的运行,除了执行计划本身,还有一些其他因素要考虑,例如语句的编译时间.执行时间.做了多少次磁盘读等. 如果DBA能够把问题语句单独测试运行,可以在运行前打开下面这三个开关,收集语句运行的统计信 ...

  10. 一个 Sql语句优化的问题- STATISTICS 统计信息

    前段时间,同事遇到一个 Sql语句的问题,一个列表分页功能响应在30 s以上,看数据库里面的数据条数,数据量也不大,相关字段的一些索引也都有,可就是慢.于是找出具体的sql 语句出来分析,分页功能主要 ...

随机推荐

  1. linux下查看内存使用情况

    基本内存术语解读 1> free -m 同样是做为缓存,buffers和cache又有啥区别呢? 于是又查了些资料,发现buffers实际应该是叫“缓冲”,其英文解释是:A buffer is ...

  2. python_docx制作word文档详细使用说明【转】

      目前网上对这一个库的介绍得很少,很零散,所以很多功能我是尽量参考其官网,但是官网上面很多功能目前只有说明文档,而代码并还没有及时更新,以至于按照官网上面做了,python却报错.比如:自定义表格的 ...

  3. Laravel 5.5 + Vue 开发单页应用

    上次我用 laravel5.3 + Vue 开发了一个简单的单页应用,这次我打算将其升级到 laravel5.5,在升级的过程中,做一下记录,其源码放在 github 上面,源码地址   开发环境 软 ...

  4. String... to 可变参数的使用

    public class testMail { public static void fun(int... x) { for(int i = 0;i < x.length;i++) { Syst ...

  5. Mysql遇到的坑

    2018-04-09 这个虽然跟粗心有关,但是Mysql没报错是哪般? select sum(play_count) from tb_user_login where user_id = 61 and ...

  6. 原生js的dom操作

    父节点parentNode 第一个子节点 只会获取到元素节点 firstElementChild ★★★★★    ​ 第一个子节点 (如果有文本节点将会获取到文本节点) firstChild ​ 最 ...

  7. PHP连接SQLServer2012两例

    首先放上 PHP连接SQLServer的驱动下载地址 http://php.net/manual/zh/ref.pdo-sqlsrv.php 另外PHP for IIS管理工具 大家可以自己搜索一下 ...

  8. Java第15章笔记

    字符串的概述 1.什么是字符串:零个或多个字符组成的有限序列 2.如何使用字符串:(使用字符串分为两步)          1)定义并初始化字符串          2)使用字符,对字符串进行一些处理 ...

  9. linux_制作本地yum源

    新建文件夹 mkdir /root/guazai 并将本地磁盘挂载到当前文件夹 mount -o loop /dev/cdrom /root/guazai/ 新建文件夹 mkdir /mnt/loca ...

  10. 【转】MongoDB导入导出以及数据库备份

    -------------------MongoDB数据导入与导出------------------- 1.导出工具:mongoexport     1.概念:         mongoDB中的m ...