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

高人指点,为什么WA?????????谢谢

Posted by bootshl at 2008-05-30 11:34:37 on Problem 2707
#include <stdio.h>
double MAX(double a, double b);
double MIN(double a, double b);
int main(void)
{
	double a, b, c, d, m, n;

	while (1) {
		scanf("%lf%lf%lf%lf", &a, &b, &c, &d);
		if (a == 0.0 || b == 0.0 || c == 0.0 || d == 0.0)
			break;
		if (MIN(a, b) <= MIN(c, d) &&
				MAX(a, b) <= MAX(c, d)) {
			printf("100%\n");
		}
		else {
			m = MIN(c, d)/MIN(a, b);
			n = MAX(c, d)/MAX(a, b);
			if ((m - n) < 0.0)
				printf("%d%c\n", (int)(m*100), '%');
			else
				printf("%d%c\n", (int)(n*100), '%');
		}

	}
	return 0;
}
double MIN(double a, double b)
{
	return (a < b) ? a : b;
}
double MAX(double a, double b)
{
	return (a > b) ? a : b;
}

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