版本比较
4.12日bfs广搜测试
正文
增加 6 行删除 6 行
84 行未改动858687888989909192939495969798999910010110210323 行未改动1271281291301311311321331341359 行未改动1451461471481491491501511521531531541551561578 行未改动16616716816917017017117217317491 行未改动84 行未改动## 代码:```cpp#include<bits/stdc++.h>#define ll long long #define ll long longusing namespace std;const int N=1e3+5;struct P{ int x, y, st;};int n,m,sx,sy,ex,ey;char mp[N][N];int r[N][N],vis[N][N];int d[4][2]={ {1,0} , {0,1} , {-1,0} , {0,-1} }; int d[4][2]={ {1,0} , {0,1} , {-1,0} , {0,-1} };void bfs(){ queue<P> q; q.push({ex,ey,0});23 行未改动 { for(int j=1;j<=m;j++) { cin>>mp[i][j]; if(mp[i][j]=='E') if(mp[i][j]=='E') { ex=i; ey=j; }9 行未改动 for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++) { if(r[i][j]>r[sx][sy] or !isdigit(mp[i][j])) continue; if(r[i][j]>r[sx][sy] or !isdigit(mp[i][j])) continue; ans+=mp[i][j]-'0'; } } cout<<ans; cout<<ans; return 0;}```## T4-小田打地鼠8 行未改动- 以每个洞为起点跑广搜,计算每个洞到每一个点的最少步数## 代码:```cpp#include<bits/stdc++.h>#define ll long long #define ll long longusing namespace std;const int N=505;struct P{91 行未改动