cf711E ZS and The Birthday Paradox】的更多相关文章

ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of 23 people, there is around 50% chance that some two of them share the same birthday. ZS the Coder finds this very interesting, an…
/* cf369E. ZS and The Birthday Paradox http://codeforces.com/contest/711/problem/E 抽屉原理+快速幂+逆元+勒让德定理+费马小定理+欧拉定理+数论 题解:https://amoshyc.github.io/ojsolution-build/cf/cf369/pe.html 坑点: 1.long long 类型的常量一定要加LL,否则1<<n只在int范围内 2.带模的题目,最后一定要判断是否答案为负,答案为负数要…
题目链接: E. ZS and The Birthday Paradox. time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that giv…
ZS and The Birthday Paradox 题目链接:http://codeforces.com/contest/711/problem/E 数学题(Legendre's formula) 这题是以生日悖论(如果有23个或23个以上的人,那么至少有两个人的生日相同的概率要大于50%)为背景的数学题.公式本身不难推,主要是对大数的处理. 首先,我们需要找到分子和分母的公因数,这里用到了Legendre's formula(举个例子:10!的因数中质数3的个数为[10/3+10/(3^2…
ZS and The Birthday Paradox 感觉里面有好多技巧.. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int, int> #define SZ(x…
E. ZS and The Birthday Paradox 题目连接: http://www.codeforces.com/contest/711/problem/E Description ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of 23 people, there is around 50% c…
ZS and The Birthday Paradox Time Limit: 20 Sec  Memory Limit: 512 MB Description Input Output Sample Input 4 3 Sample Output 23 128 HINT Solution Code #include<iostream> #include<string> #include<algorithm> #include<cstdio> #includ…
传送门 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of \(23\) people,…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output ZS the Coder has recently found an interesting concept called the Birthday Paradox. It states that given a random set of 23 people, there is aro…
已知一年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…