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

Re:求助.好心人能指点迷津吗?

Posted by 3623301987 at 2006-04-23 18:02:41 on Problem 1061
In Reply To:求助.好心人能指点迷津吗? Posted by:zhoushuzhe at 2005-10-14 00:50:53
> 
> #include <iostream.h>
> int main()
> {
> 	long x,y,m,n,l,i,s;
> 	i=1;
> 	cin>>x>>y>>m>>n>>l;
> 	s=x-y;
>     while (x-y+i*(m-n)%l!=s)
> 	{
> 		i++;
> 		if ((x+i*m)%l==(y+i*n)%l)
> 		{
> 			cout<<i;
> 			break;
> 		}
> 		
> 	}
> 	if (x-y+i*(m-n)%l==s) cout<<"Impossible"<<"\n";
>     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