dfs20pts8RE条

P1746 离开中山路

不要急,gengen队正在调试
by woshiyida @ 2024-08-20 08:33:09


@[Finner_forgeter](/user/1360746) 你申金吧,这题广搜
by FIRESTARS @ 2024-08-20 08:33:48


@[Finner_forgeter](/user/1360746) 这是广搜吧
by fire_flies @ 2024-08-20 08:34:01


@[Finner_forgeter](/user/1360746) 一眼数组开小
by FIRESTARS @ 2024-08-20 08:34:30


**神金** 广搜题你拿深搜做
by Deeplove_lzs @ 2024-08-20 08:35:18


@[Finner_forgeter](/user/1360746) renkun
by Emil_ @ 2024-08-20 08:37:10


@[chenyunxi1](/user/1273309) 别骂了,再骂破防了
by fire_flies @ 2024-08-20 08:37:23


@[chenyunxi1](/user/1273309) @[Emil_](/user/1393222) @[woshiyida](/user/1421155) 各位大佬会做么,不会做就别叫嘻嘻
by Finner_forgeter @ 2024-08-20 08:38:22


```cpp #include<bits/stdc++.h> using namespace std; char a[1100][1100]; int m,n; int sx,sy,ex,ey; //东北偏北,东北偏东,东南偏东,东南偏南 //西南偏南,西南偏西,西北偏西,西北偏北 int fx[9]={0,0,1,0,-1}; int fy[9]={0,1,0,-1,0}; int q[1000300][4]; int main() { int h=1,t=1; cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ cin>>a[i][j]; } } cin>>sx>>sy>>ex>>ey; a[sx][sy]='1'; q[1][1]=sx; q[1][2]=sy; q[1][3]=0; int tx,ty; while(h<=t){ for(int i=1;i<=4;i++){ tx=q[h][1]+fx[i]; ty=q[h][2]+fy[i]; if(a[tx][ty]=='0'){ a[tx][ty]='1'; t++; q[t][1]=tx; q[t][2]=ty; q[t][3]=q[h][3]+1; if(tx==ex&&ty==ey){ cout<<q[t[3<<endl; return 0; } } } h++; } } ```
by Whitecrane @ 2024-08-20 08:38:35


@[fire_flies](/user/1360902) 6
by Deeplove_lzs @ 2024-08-20 08:38:57


| 下一页