Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:找一本基础数论的,会很清楚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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator