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

关于这题目的答案输出

Posted by 30018347 at 2009-07-24 20:28:09 on Problem 1942
这题的输出让我很困惑。doube result,直接用c++的cout<<result<<endl是wa(改成cout<<int(result)<<endl还是wa)。改成c的printf("%.0lf\n",result)就对了。代码很简单就是组合数。哪位大牛指点下?

#include<iostream>
using  namespace std;


int main()
{
	double i;
	double col,row,sum,result,temp;
	while(cin>>col>>row){
		if(row+col==0)return 0;
		result=1;
		sum=row+col;
		if(col<row){
			temp=col;
			col=row;
			row=temp;
		}
		for(i=col+1;i<=sum;i+=1)
			result*=(i/(i-col));
		printf("%.0lf\n",result);
	}
}

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