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;
}


posted @ 2013-07-22 19:23  javawebsoa  Views(175)  Comments(0Edit  收藏  举报