A - Class Statistics

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

Submit Status Practice UVALive 5682

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[150];
     scanf("%d",&t);
     for(num=1;num<=t;num++)
     {
         scanf("%d",&n);
         for(int i=0;i<n;i++)
         scanf("%d",&a[i]);
         sort(a,a+n);
         int sum=0;
         for(int i=0;i<n-1;i++)
         {
             if(sum<(a[i+1]-a[i]))
             sum=(a[i+1]-a[i]);
         }
         printf("Class %d\n",num);
         printf("Max %d, Min %d, Largest gap %d\n",a[n-1],a[0],sum);
     }
     return 0;
 }

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

时间: 2024-11-09 19:18:02

A - Class Statistics的相关文章

URAL 1613. For Fans of Statistics(STL 数学啊 )

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1613 1613. For Fans of Statistics Time limit: 1.0 second Memory limit: 64 MB Have you ever thought about how many people are transported by trams every year in a city with a ten-million population whe

使用Statistics命令查看Netapp存储实时性能统计数据

Cluster-mode下,引入了新的命令行工具,可以查看详细的存储系统性能指标,在进行存储系统诊断时候尤其有用. 注意:使用该命令需要进入高级模式,SSH登录存储CLI环境之后,执行命令:set  –privilege  advanced.参考下图1: 图1 命令使用方法 总览 可以使用命令statistics show-periodic查看当前系统实时的性能指标概览. 图2 样本收集 也可以使用命令statistics start |stop 收集一段时间内的性能参数,然后通过statist

Measuring PostgreSQL Checkpoint Statistics

Checkpoints can be a major drag on write-heavy PostgreSQL installations. The first step toward identifying issues in this area is to monitor how often they happen, which just got an easier to use interface added to the database recently. Checkpoints

SQL SERVER 统计信息概述(Statistics)

前言 查询优化器使用统计信息来创建可提高查询性能的查询计划,对于大多数查询,查询优化器已经为高质量查询计划生成必要的统计信息,但是在少数情况下,您需要创建附加的统计信息或者修改查询设计以得到最佳结果.因此理解和合理使用统计信息是数据库优化的方式之一.   统计信息的分类 根据创建源的不同,统计信息分为两种表统计信息和索引统计信息,除非你自定义它们,否则它们之间没有本质的区别. 索引统计信息建立在索引上面,因此对于创建已经存在的数据上,在创建索引的时候会扫描全部数据,这些数据也会创建在索引的统计信

【转自mos文章】使用单条sql来查询出awr中的syatem statistics

使用单条sql来查询出awr中的syatem statistics 参考自: How to monitor system statistics from AWR snapshot by single SQL? (Doc ID 1320445.1) 适用于: Oracle Server - Enterprise Edition - Version: 10.2.0.1 and later   [Release: 10.2 and later ] Information in this documen

SET STATISTICS IO

SET STATISTICS IO (Transact-SQL) https://technet.microsoft.com/zh-cn/library/ms184361(SQL.90).aspx 如何识别SQL Server中的IO瓶颈 http://blog.csdn.net/dba_huangzj/article/details/7773744 SQLSERVER读懂语句运行的统计信息 http://www.cnblogs.com/lyhabc/archive/2013/01/13/285

一站式学习Wireshark(七):Statistics统计工具功能详解与应用

Wireshark一个强大的功能在于它的统计工具.使用Wireshark的时候,我们有各种类型的工具可供选择,从简单的如显示终端节点和会话到复杂的如Flow和IO图表.本文将介绍基本网络统计工具.包括:捕捉文件摘要(Summary),捕捉包的层次结构(Protocol Hirarchy), 会话(Conversations), 终端节点(Endpoints), HTTP. 更多信息 Summary: 从statistics菜单,选择Summary: 如下图的截屏所示,你会看到: File: 捕捉

FAQ: Automatic Statistics Collection (文档 ID 1233203.1)

In this Document   Purpose   Questions and Answers   What kind of statistics do the Automated tasks collect   How do I revert to a previous set of statistics?   Does the automatic statistic collection jobs populate CHAIN_CNT?   11g+ Automatic Mainten

PLSQL_性能优化系列15_Oracle Statistics统计信息

2014-12-18 BaoXinjian 一.摘要 Statistic 对Oracle 是非常重要的. 它会收集数据库中对象的详细信息,并存储在相应的数据字典里. 根据这些统计信息, optimizer 可以对每个SQL 去选择最好的执行计划. Statistic 对Oracle 是非常重要的,它会收集数据库中对象的详细信息,并存储在相应的数据字典里. 根据这些统计信息, optimizer 可以对每个SQL 去选择最好的执行计划. Oracle Statistic 的收集,可以使用analy

Ural 1613 For Fans of Statistics(vector应用)

题目: For Fans of Statistics Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64 Description Have you ever thought about how many people are transported by trams every year in a city with a ten-million population where one in th