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

- -不懂什么 欧几里得 这个用很多数据测试都过了 但是... 一直WA 求解

Posted by Hust_Dz at 2011-04-26 23:45:50 on Problem 1061
#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:
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