| ||||||||||
| 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-WA请问哪里错了?
谢谢!!!
#include <iostream>
#include <cstdlib>
using namespace std;
__int64 xx,yy;
__int64 extEuclid(__int64 a,__int64 b,__int64 &xx,__int64 &yy)
{
__int64 d,tmp;
if(b==0)
{
xx=1;
yy=0;
return a;
}
d=extEuclid(b,a%b,xx,yy);
tmp=xx;
xx=yy;
yy=tmp-a/b*yy;
return d;
}
int main()
{
__int64 x,y,m,n,l;
while(cin>>x>>y>>m>>n>>l)
{
__int64 answer = extEuclid(n-m,l,xx,yy);
if((x-y)%answer || m==n)
cout<<"Impossible"<<endl;
else
{
__int64 ar=1,s=l/answer;
ar *= ((x-y)/answer);
ar = (ar%s+s)%s;
cout<<ar<<endl;
}
}
system("Pause\n");
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator