acgo题库
  • 首页
  • 题库
  • 学习
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • 题目方向说明

    题目没有说明当有多个解的时候,应该遵循什么方向。 经过N次测试,发现是:下右上左

    userId_undefined

    ID眼见

    空间掌握者贪心·贪心尝试者模拟·模拟练习生荣耀黄金快乐小狗
    29阅读
    0回复
    2点赞
  • 深搜dfs栈stack 题解100%AC

    userId_undefined

    飞的智动

    8月全勤卷王题解仙人时空双修者模拟·模拟练习生秩序白银快乐小狗
    20阅读
    0回复
    2点赞
  • tj

    #include<bits/stdc++.h> using namespace std; int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1}; int n,m,a[1010][1010],sx,sy,fx,fy; char b[1010][1010]; bool vis[1010][1010],flag; struct xy{ int x,y; }; stack<xy>pxy; stack<xy>npxy; void dfs(int x,int y){ if(xfx&&yfy){ while(!pxy.empty()){ npxy.push(pxy.top()); pxy.pop(); } while(!npxy.empty()){ cout<<npxy.top().x-1<<" "<<npxy.top().y-1<<endl; npxy.pop(); } flag=1; return; } pxy.push({x,y}); vis[x][y]=1; for(int i=0;i<4;i++){ int nx=x+dx[i],ny=y+dy[i]; if(nx<1||ny<1||nx>n||ny>m||vis[nx][ny]||a[nx][ny]) continue; else{ dfs(nx,ny); } } vis[x][y]=0; pxy.pop(); } int main() { cin>>n>>m; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ cin>>b[i][j]; if(b[i][j]'X') a[i][j]=1; if(b[i][j]'S') sx=i,sy=j; if(b[i][j]=='T') fx=i,fy=j; } } vis[sx][sy]=1; dfs(sx,sy); if(flag)cout<<fx-1<<" "<<fy-1<<endl; if(flag)cout<<"YES"; else cout<<"NO"; return 0; }

    userId_undefined

    Lexore_

    小有名气8月全勤卷王循环·循环打卡人时空双修者题解仙人快乐小狗
    10阅读
    0回复
    1点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页