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. 利用sql的OVER()PARTITION 找到最相近的数值

    前几天同事问我一个问题,能不能用sql搞定这个问题: 我这里有一个张表table1中有time1,value1,有表table2有字段time2,value2. 现在要把table2中的value2更 ...

  2. qrcode解决方案大全

    QRCODE解决方案 1.delphi原生QRCode.pas 2.delphi编写http服务器实现QRcode请求生成图片,http下载 3.delphi编写cgi程序,加载到apache服务器 ...

  3. Why Linux Doesn’t Need Defragmenting

    If you’re a Linux user, you’ve probably heard that you don’t need to defragment your Linux file syst ...

  4. [Jmeter] Run Command to generate a specific listener’s chart report

    Run Command to generate a specific listener’s chart report: Download cmdrunner-2.0.jar : https://jme ...

  5. UI设计初学者必看,这款设计神器教你快速入门

    网络时代,网页和手机App已经深入到人们生活的方方面面.这也使得App界面设计越来越受青年求职者们的青睐,并纷纷投入这个行业.但是,作为UI设计初学者,究竟如何才能快速的入门?当今市场上,是否有那么一 ...

  6. office 2007,SQL Server 2008,VS2010安装步骤

    office 2007,SQL Server 2008,VS2010的安装顺序是不是office 2007,SQL Server 2008,VS2010呢? 前几天先安装了SQL Server 200 ...

  7. Ubuntu上搭建Hadoop环境(单机模式+伪分布模式) (转载)

    Hadoop在处理海量数据分析方面具有独天优势.今天花了在自己的Linux上搭建了伪分布模式,期间经历很多曲折,现在将经验总结如下. 首先,了解Hadoop的三种安装模式: 1. 单机模式. 单机模式 ...

  8. Spring Boot学习笔记:kafka应用

    Kafka作为众多Java消息中间件之一,有诸多优点.本文讲解Kafka的应用.学习一个新的知识点,建议先找一个demo,越简单越好的demo,跑通这个demo,了解大致原理,然后在分析细节,详细了解 ...

  9. Redis (非关系型数据库) 数据类型 之 String类型

    Redis 一个内存数据库,通过 Key-Value 键值对的的方式存储数据.由于 Redis 的数据都存储在内存中,所以访问速度非常快,因此 Redis 大量用于缓存系统,存储热点数据,可以极大的提 ...

  10. Java基本语法实验报告

      题目:       Java基本语法 课程名称:  JAVA语言程序设计 班    级:    信1705-1 姓    名:   刘雨馨     学号:   20173445 指导教师:    ...