当前位置:网站首页>14th test
14th test
2022-07-07 09:47:00 【moyangxian】
#include<iostream>
using namespace std;
const int N=1010;
int g[N][N]={
{
1, 1, 1, 1, 1, 1 },
{
1, 0, 0, 0, 1, 1 },
{
1, 0, 1, 0, 0, 1 },
{
1, 0, 0, 0, 1, 1 },
{
1, 1, 0, 0, 0, 1 },
{
1, 1, 1, 1, 1, 1 }
};
bool vis[N][N];
struct Node{
int x,y;
}ans[N];
int cnt;
int dis[][2]={
0,1,1,0,0,-1,-1,0};
bool check(int x,int y){
if(vis[x][y]||g[x][y]==1) return true;
return false;
}
void dfs(int x,int y,int p){
ans[p]={
x,y};
if(x==4&&y==4){
cout<<" Maze path "<<++cnt<<":"<<endl;
for(int i=1;i<=p;i++){
cout<<'('<<ans[i].x<<','<<ans[i].y<<") ";
}
cout<<endl;
return ;
}
for(int i=0;i<4;i++){
int xx=x+dis[i][0];
int yy=y+dis[i][1];
if(check(xx,yy)) continue;
vis[xx][yy]=true;
dfs(xx,yy,p+1);
vis[xx][yy]=false;
}
}
int main(){
cout<<" Maze corresponding adjacency table "<<endl;
for(int i=0;i<=5;i++){
for(int j=0;j<=5;j++){
cout<<'['<<i<<','<<j<<"]:";
if(i==0||j==0||i==5||j==5){
cout<<endl;
continue;
}
for(int k=0;k<4;k++){
int xx=i+dis[k][0];
int yy=j+dis[k][1];
if(check(xx,yy)) continue;
cout<<'('<<xx<<','<<yy<<')'<<"\t";
}
cout<<endl;
}
}
cout<<" The path of all mazes :"<<endl;
vis[1][1]=true;
dfs(1,1,1);
return 0;
}
边栏推荐
- sql 里面使用中文字符判断有问题,哪位遇到过?比如value&lt;&gt;`无`
- 【BW16 应用篇】安信可BW16模组/开发板AT指令实现MQTT通讯
- The configuration and options of save actions are explained in detail, and you won't be confused after reading it
- 如何成为一名高级数字 IC 设计工程师(5-2)理论篇:ULP 低功耗设计技术精讲(上)
- Unity3d interface is embedded in WPF interface (mouse and keyboard can respond normally)
- MongoDB怎么实现创建删除数据库、创建删除表、数据增删改查
- CMD startup software passes in parameters with spaces
- IIS faked death this morning, various troubleshooting, has been solved
- 面试被问到了解哪些开发模型?看这一篇就够了
- Impression notes finally support the default markdown preview mode
猜你喜欢
![[4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision](/img/fd/5e8f74da25d9c5f7bd69dd1cfdcd61.png)
[4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision

Dynamics 365Online ApplicationUser创建方式变更

Strategic cooperation subquery becomes the secret weapon of Octopus web browser

H5 web player easyplayer How does JS realize live video real-time recording?

Netease cloud wechat applet

iNFTnews | 时尚品牌将以什么方式进入元宇宙?

Arthas simple instructions

Information Security Experiment 2: using x-scanner scanning tool

第一讲:寻找矩阵的极小值

小程序滑动、点击切换简洁UI
随机推荐
JS逆向教程第一发
Unity uses mesh to realize real-time point cloud (II)
The configuration and options of save actions are explained in detail, and you won't be confused after reading it
进程和线程的区别
golang select机制和超时问题怎么解决
小程序实现页面多级来回切换支持滑动和点击操作
How to use clipboard JS library implements copy and cut function
如何成为一名高级数字 IC 设计工程师(1-6)Verilog 编码语法篇:经典数字 IC 设计
In fact, it's very simple. It teaches you to easily realize the cool data visualization big screen
The difference between viewpager2 and viewpager and the implementation of viewpager2 in the rotation chart
Unity shader (data type in cghlsl)
sqlplus乱码问题,求解答
【frida实战】“一行”代码教你获取WeGame平台中所有的lua脚本
Detailed explanation of diffusion model
La différence entre viewpager 2 et viewpager et la mise en œuvre de la rotation viewpager 2
Windows starts redis service
4、 Fundamentals of machine learning
Information Security Experiment 3: the use of PGP email encryption software
C# Socke 服务器,客户端,UDP
nlohmann json