Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

老是WA?

Posted by teamwolves at 2005-10-22 10:37:17 on Problem 2613
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator