| ||||||||||
| 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谁能告诉我这个代码哪儿错了 青蛙的约会问题 1061
顺便最好给几组测试数据!!!!!!!!!!!!!!!!!!
#include<iostream>
using namespace std;
int main()
{
unsigned long x,y,m,n;
long xy,mn,L,i;
cin>>x>>y>>m>>n>>L;
xy=x-y;
mn=m-n;
if(mn<0)
{
mn*=-1;
xy*=-1;
}
if(L==0)
{
cout<<"Imposible"<<endl;
system("pause");
return 0;
}
mn%=L;
if(xy%L==0)
{
cout<<0<<endl;
}
else if(mn==0 & xy%L!=0)
cout<<"Imposible"<<endl;
else
{
if(xy>0)i=1;
else i=0;
for(;i<=mn;i++)
if((L*i-xy)%mn==0)
break;
cout<<(i*L-xy)/mn<<endl;
}
system("pause");
return 0;
}
谁能告诉我这个代码哪儿错了 青蛙的约会问题 1061
顺便最好给几组测试数据!!!!!!!!!!!!!!!!!!
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator