| ||||||||||
| 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 | |||||||||
大家帮我看看我的程序阿 wronganswer!using namespace std;
int main()
{
unsigned int x,y,m,n,l,t;
cin>>x>>y>>m>>n>>l;
if(m==n)cout<<"Impossible"<<endl;
else
{
unsigned int r1,r2,d_r;
t=1;
r1=x+m*t;
r2=y+n*t;
r1>r2?(d_r=(r1-r2)):(d_r=(r2-r1));
for(;d_r%l!=0;r1+=m,r2+=n,t++){
r1>r2?(d_r=(r1-r2)):(d_r=(r2-r1));
if((r1%l==x&&r2%l==y)){
cout<<"Impossible"<<endl;
m=0;
break;}
}
if(m!=0)cout<<t-1;
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator