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

Wrong Answer,是什么原因?请大家指点下,thanks

Posted by anotherchinux at 2006-12-28 23:15:46 on Problem 1061
#include <stdio.h>

int main() {
	int x,y,m,n,l,t,i;
	scanf("%d %d %d %d %d",&x,&y,&m,&n,&l);	
	fflush(stdin);
	if(m > n) {
		m = m - n;
		x = (x>y?l-x+y:y-x);
	}
	else {
		m = n - m;
		x = (x<y?l-y+x:x-y);
	} 
	t = 1;
	while(1) {
		i = (m*t)%l;
		if(i == x) {
			printf("%d\n", t);
			break;
		}
		else if(i == 0) {
			printf("Impossible\n");
			break;
		}
		++t;
	}
	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