| ||||||||||
| 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.h>
int main()
{int x,y,m,n,L;
cin>>x>>y>>m>>n>>L;
int Num=0;
while(x!=y )
{if (m==n)
{cout<<"Impossible\n";
break;}
x=x+m;
y=y+n;
if(x>L)
{x=x%L;}
if(y>L)
{y=y%L;}
Num++;
}
if(x==y)
cout<<Num<<endl;
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator