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

Re:跳出条件错了m==0&&n==0

Posted by hdjtdxacm at 2009-03-07 10:04:21 on Problem 1942
In Reply To:大家看一下咯!帮帮忙看哪儿出问题了 和楼下贴的应该一样呀 在线等待!!!! Posted by:yunhong at 2008-07-16 22:13:37
> 我的程序:::::
> #include <iostream>
> using namespace std;
> 
> int main()
> {
> 	double n, m;
> 	while (scanf("%lf%lf", &n, &m)==2, n!=0)
> 	{
> 		double w = n<m ? n:m;
> 		double ans=1.0, i;
> 		for (i=1; i<=w; i+=1)
> 			ans *= ((n+m-i+1)/i);
> 		printf("%.0lf\n", ans);
> 	}
> 
> 	return 0;
> }
> ----------------------------
> #include < iostream >
> using namespace std;
> double com (double n,double m)
> {
> 	double i;
> 	double result(1);
> 	if ( n >= m - n ){ n = m-n; }
> 	for ( i = m;i >= m-n+1;i-=1 )
> 	{
> 		result *= (i / (i - (m - n)));
> 	}
> 	return result;
> }
> int main()
> {
> 	double n,m;
> 	while (1)
> 	{
> 		scanf("%lf%lf",&n,&m);
> 		if ( n==0 && m==0 ){ break; }
> 		printf("%.0lf\n",com (n,m+n));
> 	}
> 	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