| ||||||||||
| 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 | |||||||||
请教高手哪里出错了?1061#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long x,y,m,n,L,i;
cin>>x>>y>>m>>n>>L;
if(m==n)
cout<<"Impossible"<<endl;
else
{
if(L%(m-n)==0)
{
if((x-y)%(m-n)==0)
cout<<(L-abs(x-y))/abs(m-n)<<endl;
else
cout<<"Impossible"<<endl;
}
else
{
if((x-y)%(m-n)==0)
cout<<L-abs(x-y)/abs(m-n)<<endl;
else
{
for(i=1;i<abs(m-n);i++)
{
if((L%abs(m-n)*i)%abs(m-n)==abs(x-y)%abs(m-n))
{
cout<<i<<endl;
break;
}
}
if(i>=abs(m-n))
cout<<"Impossible"<<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