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

为什么总是超时?该怎么改进啊

Posted by andywoo111 at 2006-04-05 21:05:16 on Problem 1061
#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:
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