10491 - Cows and Cars

时间:2023-03-09 16:13:59
10491 - Cows and Cars
描述:要么全选择牛,要么选择一辆车和p-1头牛,那么剩下n+m-p道门可以选择,求选择p道门以后要选择到车的概率
#include <cstdio> int main()
{
//freopen("in.txt","r",stdin);
int m,n,p;
while(scanf("%d%d%d",&m,&n,&p)!=EOF)
{
printf("%.5lf\n",(n*m*1.0+(n-1)*n*1.0)/(m+n)/(m+n-p-1));
}
return 0;
}