CF802D
2 seconds
256 megabytes
standard input
standard output
Heidi is a statistician to the core, and she likes to study the evolution of marmot populations in each of V(1 ≤ V ≤ 100) villages! So it comes that every spring, when Heidi sees the first snowdrops sprout in the meadows around her barn, she impatiently dons her snowshoes and sets out to the Alps, to welcome her friends the marmots to a new season of thrilling adventures.
Arriving in a village, Heidi asks each and every marmot she comes across for the number of inhabitants of that village. This year, the marmots decide to play an April Fools' joke on Heidi. Instead of consistently providing the exact number of inhabitants P (10 ≤ P ≤ 1000) of the village, they respond with a random non-negative integer k, drawn from one of two types of probability distributions:
- Poisson (d'avril) distribution: the probability of getting an answer k is
for k = 0, 1, 2, 3, ...,
- Uniform distribution: the probability of getting an answer k is
for k = 0, 1, 2, ..., 2P.
Heidi collects exactly 250 answers per village. Every village follows either the Poisson or the uniform distribution. Heidi cannot tell marmots apart, so she may query some marmots several times, and each time the marmot will answer with a new number drawn from the village's distribution.
Can you help Heidi to find out whether a village follows a Poisson or a uniform distribution?
The first line of input will contain the number of villages V (1 ≤ V ≤ 100). The following V lines each describe one village. The description of each village consists of 250 space-separated integers k, drawn from one of the above distributions.
Output one line per village, in the same order as provided in the input. The village's line shall state poisson if the village's distribution is of the Poisson type, and uniform if the answer came from a uniform distribution.
2
92 100 99 109 93 105 103 106 101 99 ... (input is truncated)
28 180 147 53 84 80 180 85 8 16 ... (input is truncated)
poisson
uniform
The full example input is visually represented below, along with the probability distribution function it was drawn from (the y-axis is labeled by its values multiplied by 250).
一道很神奇的水题,泊松分布和方差有关,所以我先找到平均值
他和正态分布是想似的,怎么转换为3西格玛原则呢,就是找到所在位置呗,一半和三分之一还是比较好的,然后这里面的值应该要有比3西格玛中间的数多,随便输了个0.75,蜜汁AC
#include <bits/stdc++.h>
using namespace std;
int main(){
int T;
scanf("%d",&T);
while(T--){
int a[];
int s=;
for(int i=;i<;i++){
scanf("%d",&a[i]);
s+=a[i];
}
double ave=s/250.0;
int cnt=;
for(int i=;i<;i++){
if(fabs(a[i]-ave)<=ave/)
cnt++;
}
if(cnt>*0.75)
puts("poisson");
else
puts("uniform");
}
return ;}
CF802D的更多相关文章
随机推荐
- Java开发笔记(九十六)线程的基本用法
每启动一个程序,操作系统的内存中通常会驻留该程序的一个进程,进程包含了程序的完整代码逻辑.一旦程序退出,进程也就随之结束:反之,一旦强行结束进程,程序也会跟着退出.普通的程序代码是从上往下执行的,遇到 ...
- Django中对单表的增删改查
之前的简单预习,重点在后面 方式一: # create方法的返回值book_obj就是插入book表中的python葵花宝典这本书籍纪录对象 book_obj=Book.objects.creat ...
- Json字符串转excel表格文件
假如我们有一段json串,该json串是由一系列结构相同的数据集合组成,如下: { "data": [ { "groupId": "com.test. ...
- SQL SERVER 2008 系列问题:无法访问,混合模式
转载请注明:http://www.cnblogs.com/dachen408/p/7878494.html 使用本机服务器名'.'登录,使用windows模式: 1.修改登录模式为混合模式:右键服务器 ...
- 电脑公司最新稳定win7系统下载
系统来自系统妈:http://www.xitongma.com 系统概述 电脑公司ghost win7 x86(32位)万能装机版集成的软件符合电脑公司及电脑城装机绝大多数人要求及喜好,既大众,又时尚 ...
- Win7下vc++6.0打开项目出现问题的解决方案
Win7下vc++6.0打开项目出现Microsoft(R) Developer Studio以及Unable to register this add-in because its DLLRegis ...
- iOS5 and iOS6都只支持横屏的方法
If your app uses a UINavigationController, then you should subclass it and set the class in IB. You ...
- CPP-基础:关于多态
类的多态特性是支持面向对象的语言最主要的特性,有过非面向对象语言开发经历的人,通常对这一章节的内容会觉得不习惯,因为很多人错误的认为,支持类的封装的语言就是支持面向对象的,其实不然,Visua ...
- 2017年网络空间安全技术大赛部分writeup
作为一个bin小子,这次一个bin都没做出来,我很羞愧. 0x00 拯救鲁班七号 具体操作不多说,直接进入反编译源码阶段 可以看到,只要2处的str等于a就可以了,而str是由1处的checkPass ...
- HTML5 Geolocation(地理位置)
HTML5 Geolocation(地理位置).是用来定位用户的位置的. HTML5 Geolocation API 用于获得用户的地理位置,鉴于该特性可能侵犯用户的隐私权,除非用户同意,否则不能获取 ...