| ||||||||||
| 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 | |||||||||
为什么Time Limit Exceed ??#include<stdio.h>
#include<math.h>
void main()
{
int x,y,m,n,l;
int i,p,q,tt,zz;
scanf("%d",&x);
scanf("%d",&y);
scanf("%d",&m);
scanf("%d",&n);
scanf("%d",&l);
tt=x;
zz=y;
for(i=1;;i++)//跳的次数
{
p=(x+m*i)%l;
q=(y+n*i)%l;
if(p==q)
{
printf("%d",i);
break;
}
else if(abs(p-q)==abs(tt-zz))
{
printf("impossible");
break;
}
tt=p;
zz=q;
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator