召唤玩火影的,来天目山后初次觉得火影小众
2024-08-16 18:51:45
发布于:浙江
哥们打算仿那个写崩铁的写个火影,目前正在改代码,写好了发上来
全部评论 3
#include<bits/stdc++.h> #define int long long using namespace std; char mapp[4][101],vis[4][101]; int n,m,t,stx,sty; int fx[3]={-1,0,1}; struct node{ int x,y,step; }; vector<int>v[4][101]; queue<node>q; bool check(int x,int y,int step){ for(int i=0;i<v[x][y].size();i++){ if(step==v[x][y][i]){ return 1; } }return 0; } signed main(){ cin>>t; while(t--){ while(!q.empty())q.pop(); for(int i=1;i<=3;i++){ for(int j=1;j<=n;j++){ v[i][j].clear(); vis[i][j]=0; } }cin>>n>>m; for(int i=1;i<=3;i++){ for(int j=1;j<=n;j++){ cin>>mapp[i][j]; if(mapp[i][j]!='.'&&mapp[i][j]!='s'){ v[i][j].push_back(0); for(int k=j-2,sum=1;k>=0;k-=2,sum++){ v[i][k].push_back(sum); } }else if(mapp[i][j]=='s'){ stx=i,sty=j; } } }q.push({stx,sty,0}); bool flag=0; while(!q.empty()){ node t=q.front(); q.pop(); bool fl=0; if(fl)continue; if(t.y==n){ flag=1; cout<<"YES\n"; break; }for(int i=0;i<3;i++){ int xx=t.x+fx[i]; int yy=t.y+1; if(xx<1||xx>3||vis[xx][yy]||check(xx,yy,t.step)||check(xx,yy,t.step+1))continue; if(i!=1){ if(check(t.x,yy,t.step))break; } q.push({xx,yy,t.step+1}); vis[xx][yy]=1; } }if(!flag)cout<<"NO\n"; } }
喵喵喵?
2024-08-18 来自 浙江
0懒得写了,不如手机玩,开摆
2024-08-17 来自 浙江
0智齿
2024-08-17 来自 浙江
0算了懒得打了,不如直接手机上玩😭
2024-08-17 来自 浙江
0(),就多练
2024-08-17 来自 浙江
0
有帮助,赞一个