显示代码纯文本
//HZOI 2016
#include<stdio.h>
#include<memory.h>
int main()
{
//unsigned long long s1,s2,s11,s22;
int p,q,r,s,i,max1,max2,min1,min2,j;
double c,s1,s2;
freopen("T1_.in","r",stdin);
freopen("T1_.out","w",stdout);
while (scanf("%d %d %d %d",&p,&q,&r,&s)==4)
{
c=1.00;
if (q<p-q)
{
max1=p-q;
min1=q;
}
else
{
max1=q;
min1=p-q;
}
if (s<r-s)
{
max2=r-s;
min2=s;
}
else
{
max2=s;
min2=r-s;
}
s1=1;
s2=1;
i=max1+1;
j=1;
while ((i<=p)||(j<=min1))
{
if (i<=p)
{
s1=1.00*s1*i;
i++;
}
if (j<=min1)
{
s1=1.00*s1/j;
j++;
}
}
i=max2+1;
j=1;
while ((i<=r)||(j<=min2))
{
if (i<=r)
{
s2=s2*i*1.00;
i++;
}
if (j<=min2)
{
s2=1.00*s2/j;
j++;
}
}
c=s1/s2;
printf("%.5lf\n",c);
}
return 0;
}