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

why wrong

Posted by sheep68 at 2012-05-29 17:32:23 on Problem 1061
#include <stdio.h>
int main(void)
{
	long int x,y,m,n,l,cha,count,dis,i;
	scanf("%ld%ld%ld%ld%ld",&x,&y,&m,&n,&l);
	cha=m-n;
	dis=y-x;
	if(cha==0)
	   printf("Impossible\n");
	else{
		if(dis>0&&cha<0){
			dis=l-dis;
			cha=-cha;
		}
		else if(dis<0&&cha>0)
			dis=l+dis;
		else if(dis<0&&cha<0){
			dis=-dis;
			cha=-cha;
		}
	for(i=0;;i++){
		count=(dis+i*l)/cha;
		if(count*cha==dis+i*l)
			break;
	}
	printf("%d\n",count);
	}
	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