hdu_5139 概率问题
生活随笔
收集整理的這篇文章主要介紹了
hdu_5139 概率问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int t;scanf("%d",&t);
int c=t;
while(t--){
long long x;
int b;
double cnt=1.0;
long long sum;
scanf("%lld%d",&x,&b);
double a=-1.0/x;
for(int i=;i<b;i++)
cnt*=a;
cnt=1.0-cnt;
sum=(+x)*x/2.0;
double ans=sum*cnt;
printf("Case #%d: %.3lf\n",c-t,ans);
}
return ;
}
注意精度
總結
以上是生活随笔為你收集整理的hdu_5139 概率问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python- generator生成器
- 下一篇: 上传工程到github