rt,我的程序运行就卡住
#include<bits/stdc++.h>
using namespace std;
const int maxn=1000;
int a,b;
struct Node{
int xpos,bushu;
};
int dx[]={0,1,-1,5,-5,10,-10};
bool vis[maxn];
int bfs(int x){
queue<Node>q;
q.push({x,0});
vis[x]=1;
while(!q.empty()){
Node now=q.front();
if(now.xpos==b){
return now.bushu;
}
for(int i=1;i<=6;i++){
int nx=now.xpos+dx[i];
if(nx>=0&&nx<=maxn&&vis[nx]==0){
q.push({nx,now.bushu+1});
vis[nx]=1;
}
}
}
return -1;
}
int main(){
cin>>a>>b;
cout<<bfs(a)<<endl;
return 0;
}