您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 2浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

*待改 [Acwing] 一维bfs 抓住那头牛

*DDL_GzmBlog 发布时间:2021-06-14 16:09:16 ,浏览量:2

目录
  • 问题
  • 解决
  • CODE

[传送门]

问题

如何在一维数组求最小步数

解决

和二维处理一样

但是我sef了

CODE
#include 
using namespace std;
const int N  = 1e5+10;
int dist[N];
int st[N];
int n,k;

void bfs(int x)
{
    memset(dist,0,sizeof dist);
    queue q;
    q.push(x);
    st[x] = 1;
    dist[x] = 0;

    while(!q.empty())
    {
        int t = q.front();
        q.pop();

        if(t==k)
        {
            cout>k;
    bfs(n);
}
int main()
{
    solve();
    return 0;
}
关注
打赏
1657615554
查看更多评论
立即登录/注册

微信扫码登录

0.0377s