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 8013 at 2003-12-14 10:53:18 on Problem 1061
In Reply To:Re:怎么求与呢?我这个竟然还是wa,tle都没有机会 Posted by:first at 2003-12-13 18:57:50
> #include <iostream>
> using namespace std;
> void main()
> {
> 	long x,y,m,n,L,len,dist;
> 	while(cin>>x>>y>>m>>n>>L)
> 	{
> 	if(m==n&&(x-y)%L!=0)
> 		cout<<"Impossible\n";
> 	else
> 	{
> 		int k=0;
> 		while(((x+(k*m)%L)%L-y-(n*k)%L)%L!=0&&k<L)
> 		{
> 			k++;
> 		}
> 		  if(k<L)
>             cout<<k<<endl;
> 	      else
> 			cout<<"Impossible\n";
> 	}
> 	}
> 	
> 	
> }

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