UVA10370 Above Average

Above Average

It is said that 90% of frosh expect to be above average in their class. You are to provide a reality check.

The first line of standard input contains an integer C, the number of test cases. C data sets follow. Each data set begins with an integer, N, the number of people in the class (1 <= N <= 1000). N integers follow,
separated by spaces or newlines, each giving the final grade (an integer between 0 and 100) of a student in the class. For each case you are to output a line giving the percentage of students whose grade is above average, rounded to 3 decimal places.

Sample Input

5
5 50 50 70 80 100
7 100 95 90 80 70 60 50
3 70 90 80
3 70 90 81
9 100 99 98 97 96 95 94 93 91

Output for Sample Input

40.000%
57.143%
33.333%
66.667%
55.556%
#include <stdio.h>
int arr[1002], id;
double ave;

int main()
{
	int t, n, i, count;
	scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
		ave = 0;
		for(i = 0; i < n; ++i){
			scanf("%d", arr + i);
			ave += arr[i];
		}
		ave /= n;
		count = 0;

		for(i = 0; i < n; ++i)
			if(arr[i] > ave) ++count;
		printf("%.3lf%%\n", count * 100.0 / n);
	}
	return 0;
}
时间: 2025-01-06 09:14:31

UVA10370 Above Average的相关文章

training 2

Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.136 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.000 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.198 Average Precision (AP)

UVA-10370

/******************************************************************** @file Main_practise.cpp @date 2014-8-22 @author Tiger @brief Problem D: Above Average ********************************************************************/ #include <cstdio> //#de

深度学习方法(十):卷积神经网络结构变化——Maxout Networks,Network In Network,Global Average Pooling

技术交流QQ群:433250724,欢迎对算法.技术感兴趣的同学加入. 最近接下来几篇博文会回到神经网络结构的讨论上来,前面我在"深度学习方法(五):卷积神经网络CNN经典模型整理Lenet,Alexnet,Googlenet,VGG,Deep Residual Learning"一文中介绍了经典的CNN网络结构模型,这些可以说已经是家喻户晓的网络结构,在那一文结尾,我提到"是时候动一动卷积计算的形式了",原因是很多工作证明了,在基本的CNN卷积计算模式之外,很多简

Average

public class Average { public static void main(String[] args) { // TODO 自动生成的方法存根 int i=args.length; int[]arr=new int [10]; int num =0; int k =0; int p=0; for(int j=0;j<i;j++){ arr[j]=Integer.parseInt(args[j]); if(arr[j]<0){ k++; } else p++; num =nu

PAT甲题题解-1108. Finding Average (20)-字符串处理

求给出数的平均数,当然有些是不符合格式的,要输出该数不是合法的. 这里我写了函数来判断是否符合题目要求的数字,有点麻烦. #include <iostream> #include <cstdio> #include <algorithm> #include <string.h> using namespace std; const int maxn=105; bool islegal(char*str){ int len=strlen(str); int p

UVa 1451 Average -斜率优化

A DNA sequence consists of four letters, A, C, G, and T. The GC-ratio of a DNA sequence is the number of Cs and Gs of the sequence divided by the length of the sequence. GC-ratio is important in gene finding because DNA sequences with relatively high

Linux 性能监控 —— Load Average

一. 简介 top. uptime. cat /proc/loadavg 命令中 Load average: 4.90, 5.51, 5.77 总体含义: 正在运行的任务数量 + 排队的任务数量 第一个数字例如上述的 4.90 代表上 1 分钟的数据 第二个数字例如上述的 5.51 代表前 5 分钟的数据 第三个数字例如上述的 5.77 代表前 15 分钟的数据 二. 多核和多 CPU 的区别 1 个 CPU 单核系统 Load average:1 表示有 1 个正在运行任务, 1 个 CPU

ZOJ 3819 Average Score(平均分)

[题目描述] English 中文 Bob is a freshman in Marjar University. He is clever and diligent. However, he is not good at math, especially in Mathematical Analysis. After a mid-term exam, Bob was anxious about his grade. He went to the professor asking about t

HDOJ 5353 Average 模拟

各种情况特判,然后枚举前两个点之间的关系 Average Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 1723    Accepted Submission(s): 438 Special Judge Problem Description There are n soda sitting around a round tabl