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 |
谢谢啦In Reply To:彻底int64就可 Posted by:rruucc at 2004-02-07 00:18:01 > > //彻底int64就可 > > #include <stdio.h> > #define int64 __int64 > > void ExtEuclid(int64 a,int64 b,int64& d,int64& x,int64& y) > { int64 temp; > if (b==0) > {d=a; x=1; y=0; > return; > } > ExtEuclid(b,a%b,d,x,y); > temp=x-y*(a/b); > x=y; y=temp; > } > > int main() > {int64 x,y,m,n,l,a,b,d,u,v,ans; > scanf("%I64d%I64d%I64d%I64d%I64d",&x,&y,&m,&n,&l); > a=(l+m-n)%l; b=(l+y-x)%l; > ExtEuclid(a,l,d,u,v); > if (b%d!=0) > printf("Impossible\n"); > else > {ans=(u*(b/d)%l); > if (ans<0) ans+=l; > ans=ans%(l/d); > printf("%I64d\n",ans); > } > return 0; > } > 谢谢 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator