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

改了一下,添加了0次的判断

Posted by xdzhang at 2009-07-14 12:40:55 on Problem 1061
In Reply To:这个程序为何通不过?谁可以帮我举个反例 Posted by:xdzhang at 2009-07-14 12:34:39
#include <stdio.h>
void main()
{
	unsigned long x,y,m,n,l,i,t;
	scanf("%u%u%u%u%u",&x,&y,&m,&n,&l);
	for(i=1;i<=l;i++)
	{
		x%=l;
		y%=l;
		if(x==y)
		{
			printf("%d",0);
			return;
		}
		t=m*i%l-n*i%l;
		if(t<0)
			t+=l;
		if(t==((y>x)?y-x:x-y))
		{
			printf("%d",i);
			return;
		}
	}
	printf("Impossible");
}

> 			return;
> 		}
> 	}
> 	printf("Impossible");
> }

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