| ||||||||||
| 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 | |||||||||
谁能帮我看看,为什么代码runtime_error#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator