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

求助:一段程序,Language选择G++总是WA,选C++就AC了,为啥?!

Posted by River_of_Time at 2013-01-05 17:05:58 on Problem 1942
#include <stdio.h>

double result(double Row, double Column)
{
	if(Row > Column)
	{
		double tmp = Row;
		Row = Column;
		Column = tmp;
	}

	double sum = Row + Column;

	double Res = (double)1.0;

	double i;
	for(i = sum; i >= Column + 1; i --)
	{
		Res *= (double)i / (double)Row;
		Row --;
	}
	return Res;
}

int main()
{
	double x, y;
	double Ans = 0;

	while(1)
	{
		scanf("%lf %lf", &x, &y);

		if(x == 0 && y == 0)
			break;

		Ans = result(x, y);

		printf("%.0lf\n", Ans);
	}
	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