| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
老是WA?#include <stdio.h>
#include <math.h>
double c(int m,int n);
int main()
{
int p,q,r,s;
double result1,result2,finalresult;
while (scanf("%d%d%d%d",&p,&q,&r,&s)==4)
{
result1 = c(p,q);
result2 = c(r,s);
if((result1-result2)>log(100000000))
break;
finalresult = exp(result1-result2);
printf("%.5lf\n",finalresult);
}
return 0;
}
double c(int m, int n)
{
int i;
double temp1= 0.0,temp2 = 0.0;
for(i=1;i<=m-n;i++)
{
temp1+=log(i);
temp2+=log(n+i);
}
return temp2 - temp1;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator