标签:name span cow std tar cst 开始 include https
https://vjudge.net/problem/UVA-10491
题意:
a头牛,b辆车,每扇门后面都有一头牛或一辆车
开始选手选择一扇门
然后主持人打开c扇有牛的门(选中的除外)
然后选手换一扇门
问最后选手选的门后面是车的概率
开始选牛的概率: 牛/总
又换到车的概率: 车/(总-c-1)
开始选车的概率: 车/总
又换到车的概率: (车-1)*(总-c-1)
总概率: 牛/总 * 车/(总-c-1) + 车/总 * (车-1)*(总-c-1)
#include<cstdio> using namespace std; int a,b,c; int main() { while(scanf("%d%d%d",&a,&b,&c)!=EOF) printf("%.5lf\n",1.0*a/(a+b)*b/(a+b-c-1)+1.0*b/(a+b)*(b-1)/(a+b-c-1)); }
标签:name span cow std tar cst 开始 include https
原文地址:http://www.cnblogs.com/TheRoadToTheGold/p/6936327.html