LightOJ-1104-birthday Paradox(概率)】的更多相关文章

题目链接:https://vjudge.net/problem/LightOJ-1104 1104 - Birthday Paradox    PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB Sometimes some mathematical results are hard to believe. One of the common problems is the birthday par…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1104 题意:一年365天,在有23个人的情况下,这23个人中有两个人生日相同的概率是大于 0.5 的: 现在在不同的星球上一年有n天,求出x,至少有 x 个人才能使得这 x 人中有两个人的生日相同的概率是>=0.5的:现在除了自己之外还要 x 个人,求x: 我们按 n = 365 算的话,那么有x个人,这些人生日都不相同的概率是 p = 1 * 364/365 * 363/365 *…
题意:给定一个一年的天数,求最少多少人可以使至少两人生日同一天的概率不少于0.5. 用二分去做.检验一个数是否符合时,刚开始实用普通的方法,直接计算,超时了~~,上网搜了一下代码,一位大神使用一个数组保存n!,因为阶乘的上升速度太快,100!就已经很大了,题目范围是到10W,直接保存肯定是要超啊~~,取对数就可以了. #include<stdio.h> #include<math.h> #define maxn 100010 double s[maxn],t; double fun…
Sometimes some mathematical results are hard to believe. One of the common problems is the birthday paradox. Suppose you are in a party where there are 23 people including you. What is the probability that at least two people in the party have same b…
题意:每年n天,求最少几个人使这些人中最少两个人生日相同的概率大于0.5 题解:直接递推,假设有k个人,所有情况为n^k,没有相同的情况为n*(n-1)*...*(n-k+1),可以算出1e5以内不超过400,复杂度不会爆炸 #include<bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back #define pi acos(-1.0) #define ll lo…
题目链接:LightOJ - 1030 Description You are in a cave, a long cave! The cave can be represented by a \(1 \times N\) grid. Each cell of the cave can contain any amount of gold. Initially you are in position \(1\). Now each turn you throw a perfect \(6\) s…
已知一年365天找23个人有2个人在同一天生日的概率 > 50% 给出n,k ,表示现在一年有2^n天,找k个人,有2个人在同一天生日的概率,求出来的概率是a/b形式,化到最简形式,由于a,b可能非常大,对a,b分别%(10^6+3) 注意,这道题是先化到最简,再分别取模 首先,特判 k > 2^n 时,a = 1,b = 1 没有2个人同一天生日的概率为: 2^n * (2^n - 1) * ... * (2^n - k + 1) / 2^(nk) 所以a,b化简之前分别是: a = 2nk…
题意: 给你一年有n天,求至少有m人使得至少有两个人在同一天生日的概率不少于0.5. 分析: 任意两个人不在同一天生日的概率为C(n,m)*m!/n^m,它的对立事件A为至少有两个人在同一天生日, 则P(A) = 1 - C(n,m)*m!/n^m = 1 - P(n,m)/n^m(后一个P表示排列); 根据题意有P(A) >= 0.5 即 P(n, m)/n^m <= 0.5. 该式的展开式为 p = n/n*(n-1)/n*(n-2)/n*...*(n-m+1)/n,因此只要判断该式的累乘…
Description Given a dice with n sides, you have to find the expected number of times you have to throw that dice to see all its faces at least once. Assume that the dice is fair, that means when you throw the dice, the probability of occurring any fa…
题目链接:https://cn.vjudge.net/problem/LightOJ-1030 You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold. Initially you are in position 1. Now each turn you throw a perfect 6 si…