| ||||||||||
| 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 | |||||||||
神那,救救我吧!!!!#include<iostream>
using namespace std;
int main()
{
int a=0,x,y,m,n,l,xx,yy;
cin>>x>>y>>m>>n>>l;
while(x!=y){
a++;
xx=x;
yy=y;
x=x+m;
y=y+n;
while(x>l || y>l){
if(x>l){
x=x-l;
}
if(y>l){
y=y-l;
}
}
if(x==xx && y==yy){
cout<<"impossible"<<endl;
return 0;
break;
}
}
cout<<a<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator