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

谁能帮我看看,为什么代码runtime_error

Posted by liujianwei_acmer at 2014-03-20 15:34:59
#include <iostream>
using namespace std;


int main()
{
	int x,y,m,n,L,stepnum=0;
	int state[210];
	cin>>x>>y>>m>>n>>L;

	while(1)
	{
		if(x == y)
		{
			cout<<stepnum<<endl;
			return 0;
		}

		
		if(y > x)
		{	
			if(state[y - x]==1)
			{
				cout<<"Impossible"<<endl;
				return 0;
			}else
			state[y - x] = 1;
		}
		else
		{
			if (state[L + (x - y)]==1)
			{
				cout<<"Impossible"<<endl;
				return 0;
			}else
				state[L + (x - y)] = 1;
		}
		x = (x+m)%L;
		y = (y+n)%L;
		stepnum++;
	}
	
	return 0;
}

#############################################################
POJ伤不起啊,错了都不知道哪里错

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