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 |
Re:这样为什么WA掉了?哪位高手清帮忙看下。。。谢谢!In Reply To:这样为什么WA掉了?哪位高手清帮忙看下。。。谢谢! Posted by:starkerry at 2011-02-12 10:47:15 > #include <iostream> > using namespace std; > int main () > { > double n,m; > while (scanf("%lf%lf",&n,&m)!=EOF) > { > if(n==0&&m==0) > break; > double x,y,ans=1.0; > x=n<m? n:m; > y=n>m? n:m; > int i=0; > for (i=y+x;i>=y+1;i--) > { > ans=ans*i; > } > double s=1.0; > int j=0; > for (j=x;j>=1.0;j--) > { > s=s*j; > } > printf("%.0lf\n",ans/s); > } > return 0; > } 浮点数精度问题,一边乘,一边除,保证结果不会太大,别人用64位整数都搞得定。 这题目很菜 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator