Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

1061-WA

Posted by WXuan at 2008-05-07 20:58:47
请问哪里错了?
谢谢!!!
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator