您的位置:首页 > 其它

UVA 10056 What is the Probability ?

2015-12-29 11:09 381 查看
题目描述

简单的推一下就行了

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
int n,an;
double p;
double ans,a1;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
scanf("%d%lf%d",&n,&p,&an);
if(p==0) ans=0;
else
{
a1=p*(1-pow(1-p,1000*n))/(1-pow(1-p,n));
//cout<<a1<<" ";
ans=a1*pow(1-p,an-1);
}
printf("%.4lf\n",ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: