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 |
好奇怪,这种做法好像真的没错耶,就是不知道为什么不对,大家帮忙看看吧。#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator