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

好奇怪,这种做法好像真的没错耶,就是不知道为什么不对,大家帮忙看看吧。

Posted by 00448151 at 2005-10-07 11:24:40 on Problem 2613
#include<iostream.h>
#include<iomanip.h>
#include<math.h>

double c(int m, int n){
	int i;
	double s=0.0;
	for(i=0;i<n;i++){
		s+=(double)log(m-i)-(double)log(n-i);
	}
	return s;
}
void main(void){
	int p,q,r,s;
	double res1,res2,res;
	while(cin>>p>>q>>r>>s){
		res1=c(p,q);
		res2=c(r,s);
		res=(double)exp(res1-res2);
		cout<<setiosflags(ios::fixed)<<setprecision(5)<<res<<endl;
	}
}


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