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

我的2163 也是WA,但是不知道有什么地方错了?希望高手指点一下!谢谢!<内有程序>

Posted by Bulrush at 2005-09-13 23:36:24
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
long double combine(int x,int y,int n,int m){
	long double sum=1;
	if(2*y>x)
		y=x-y;
	if(2*m>n)
		m=n-m;
	for(int i=y,j=x,k=m,l=n;i>=1||k>=1;--i,--j,--k,--l){
		if(i<1)i=1,j=1;
		if(k<1)k=1,l=1;
		sum*=(long double)(j*k)/(i*l);
	}
	return sum;
}

int main(){
	int p,q,r,s;
	long double sun;
	freopen("in.txt","r",stdin);
	freopen("ou.txt","w",stdout);
	while(cin>>p>>q>>r>>s){
		sun=combine(p,q,r,s);
		printf("%.5lf\n",sun);
	}
	return 0;
}

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