Submission #5713270


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

int change[6]={1,-1,5,-5,10,-10},now[99999999],step[99999999],check[99999999];
int a,b,head,tail=1;

int main()
{
	cin>>a>>b;
	if(a==b)
	{
		cout<<0;
		return 0;
	}
	now[tail]=a;
	check[a]=1;
	while(head<=tail)
	{
		head++;
		for(int i=0;i<=5;i++)
		{
			tail++;
			if(now[head]+change[i]>=0)
				now[tail]=now[head]+change[i];
			else
			{
			    tail--;
			    continue;
			}
			if(check[now[tail]])
			{
				tail--;
				continue;
			}
			else
			{
				check[now[tail]]=1;
				step[tail]=step[head]+1;
			}
			if(now[tail]==b)
			{
				cout<<step[tail];
				return 0;
			}
		}
	}	
	return 0;
}

Submission Info

Submission Time
Task B - リモコン
User luogu_bot1
Language C++ (GCC 5.4.1)
Score 0
Code Size 643 Byte
Status CE

Compile Error

./Main.cpp:27:8: error: stray ‘\357’ in program
        tail--;
        ^
./Main.cpp:27:8: error: stray ‘\274’ in program
./Main.cpp:27:8: error: stray ‘\233’ in program
./Main.cpp: In function ‘int main()’:
./Main.cpp:28:8: error: expected ‘;’ before ‘continue’
        continue;
        ^