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 |
谁看一下我的代码哪错了,改不出来,不胜感激啊。。。。。#include<iostream> #include<cmath> using namespace std; int x; int y; int gcd(int a,int b,int& x,int& y) { int d,temp; if(b==0) { x=1;y=0; return a; } d=gcd(b,a%b,x,y); temp=x; x=y; y=temp-(a/b)y; return d; } int main() { int X,Y,m,n,L; while(cin>>X>>Y>>m>>n>>L) { int d=gcd(abs(m-n),L,x,y), x0; if(d/(Y-X)==0) { x0=x*((Y-X)/d)%L; cout<<x0<<endl; } else cout<<"Impossible\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