湖南师范大学2018年大学生程序设计竞赛新生赛 E 愤怒的巨巨

点击打开链接

二项分布 期望值np 注意这里是1-p。还有注意p的小数点不超过6位

#include
using namespace std;
int gcd(int a,int b)
{
    return b==0?a:b=gcd(b,a%b);
}
int main()
{
    double p;cin>>p;
    if(p>=1) cout<<"Sorrry,JuJu!";
    else
    {
        int e=1e6;
        int a=(e-e*p);
        cout<

你可能感兴趣的:(牛客网)