样例都没过
#include<bits/stdc++.h>
using namespace std;
int a,b;
int d[6]={1,-1,5,-5,10,-10};
void bfs(int x)
{
queue<pair<int,int> > q;
q.push(make_pair(x,0));
while(!q.empty())
{
for(int i=0;i<6;i++)
{
int nx=q.front().first+d[i];
q.push(make_pair(nx,q.front().second+1));
if(nx==b)
{
cout<<q.front().second;
return;
}
}
q.pop();
}
}
int main()
{
cin>>a>>b;
if(a==b)
{
cout<<0;
return 0;
}
bfs(a);
return 0;
}