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:怎么求与呢?我这个竟然还是wa,tle都没有机会In Reply To:Re:求余吧,还要小心The time limted Posted by:8013 at 2003-12-13 17:21:07 #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