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 |
- -不懂什么 欧几里得 这个用很多数据测试都过了 但是... 一直WA 求解#include<stdio.h> int main(){ __int64 x,y,m,n,l,s,r,p,t=1; scanf("%I64d %I64d %I64d %I64d %I64d",&x,&y,&m,&n,&l); x=x%l; y=y%l; m=m%l; n=n%l; s=m-n; r=(s-y+x)%l; if(r<0) r+=l; p=r; do{ t++; p+=s; p=p%l; if(p<0) p+=l; } while(p!=0&&p!=r); if(p==0) printf("%I64d",t); else printf("Impossible"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator