| ||||||||||
| 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 | |||||||||
我的2163 也是WA,但是不知道有什么地方错了?希望高手指点一下!谢谢!<内有程序>#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator