zoj 1915 Above Average

原创 2012年03月31日 12:34:44
#include "iostream"
#include "algorithm"
#include "memory.h"
#include "iomanip"
using namespace std;

int main()
{
	int num[1010];
	int testcase, n, i, sum, average, count;
	double ans;
	cin >> testcase;
	while (testcase--)
	{
		cin >> n;
		memset(num, 0, sizeof(num));
		sum = average = count = 0;
		for (i = 0; i < n; i++)
			cin >> num[i];
		for (i = 0; i < n; i++)
			sum += num[i];
		average = sum / n;
		for (i = 0; i < n; i++)
			if (average < num[i])
				count++;
		ans = count * (1.0) / n * (1.0);
		cout.setf(ios::fixed);
		cout << setprecision(3) << ans * 100 << "%" << endl;
	}
}

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

ZOJ 3819 Average Score【水题】

Average Score Time Limit: 2 Seconds      Memory Limit: 65536 KB Bob is a freshman in Marjar Univer...

zoj 2912 hdu 2376 Average distance 树形

题目大意: 求出任意两点之间的距离,并求其平均值 这个题我们是在组队训练的时候做的,看到这个题,队友马上就给我了,简单,但是由于数据类型的选择,和精度的问题,我们到最后都没有A,可惜啊,这是比较简...

ZOJ 3819 Average Score

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3819 题面: Average Score Time Li...

ML1910+1915主板加粉破解

  • 2011-06-01 08:45
  • 416KB
  • 下载

Android Studio 混淆打包 IOException: Please correct the above warnings first

Android studio 混淆打包时,出现Error:Execution failed for task ':app:proguardRelease'. > java.io.IOExcept...

iOS开发 pod install遇到的问题If none exists, create a ticket, with the template displayed above

[!] Oh no, an error occurred. Search for existing GitHub issues similar to yours If none exists, c...

On NTFS there is metadata (data which "lives above" your data).

On NTFS there is metadata (data which "lives above" your data).Metadata are special files that the N...

Gradle build报错:Please correct the above warnings first解决方案

转载:gradle build报错:Please correct the above warnings first解决方案问题描述:在编译的时候,出现了下面的错误提示Warning: there we...

Android初学者Eclispe环境启动遇This Android SDK requires Android Developer Toolkit version 23.0.0 or above

当我们进行Android开发,配置安装环境Eclispe&SDK&ADT过程中,在SDK在线安装后,重新登录Eclispe,会出现警告框:This Android SDK requires Andr...

This is caused by library dependencies that have been compiled using Java 8 or above.

1.错误现象         在用android studio编译项目的时候提示错误:Error:Error converting bytecode to dex: Cause: Dex cannot...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)