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

高手帮优化一下,TLE

Posted by xuhk at 2008-10-13 18:54:26 on Problem 1061
#include<iostream>
using namespace std;
int main(){
    long x,y,m,n,L,a;
		cin>>x>>y>>m>>n>>L;
	for(int i=0;;i++){
		if(x==y){
	    cout<<i;
		break;
	}
	x=x+m;
	if(x>L)
		x=x%L;
	y=y+n;
	if(y>L)
		y=y%L;

	if(m==n){
		cout<<"improssible";
		break;
	}
	}

	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