当前位置:网站首页>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;
}
边栏推荐
- ViewPager2和VIewPager的区别以及ViewPager2实现轮播图
- Upload taro pictures to Base64
- 大佬们,有没有遇到过flink cdc读MySQLbinlog丢数据的情况,每次任务重启就有概率丢数
- asp. How to call vb DLL function in net project
- Oracle installation enhancements error
- js逆向教程第二发-猿人学第一题
- flex弹性布局
- CDZSC_2022寒假个人训练赛21级(1)
- flink. CDC sqlserver. 可以再次写入sqlserver中么 有连接器的 dem
- [4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision
猜你喜欢

Software modeling and analysis

Vs2013 generate solutions super slow solutions

Octopus future star won a reward of 250000 US dollars | Octopus accelerator 2022 summer entrepreneurship camp came to a successful conclusion

Lesson 1: finding the minimum of a matrix

Information Security Experiment 4: implementation of IP packet monitoring program

In fact, it's very simple. It teaches you to easily realize the cool data visualization big screen

基于智慧城市与储住分离数字家居模式垃圾处理方法
![[bw16 application] Anxin can realize mqtt communication with bw16 module / development board at instruction](/img/7f/d0917366c68865222154d82b9e7b40.png)
[bw16 application] Anxin can realize mqtt communication with bw16 module / development board at instruction
![[Frida practice]](/img/20/fc68bcf2f55b140d6754af6364896b.png)
[Frida practice] "one line" code teaches you to obtain all Lua scripts in wegame platform

How does mongodb realize the creation and deletion of databases, the creation of deletion tables, and the addition, deletion, modification and query of data
随机推荐
Sqlplus garbled code problem, find the solution
golang select机制和超时问题怎么解决
How does mongodb realize the creation and deletion of databases, the creation of deletion tables, and the addition, deletion, modification and query of data
章鱼未来之星获得25万美金奖励|章鱼加速器2022夏季创业营圆满落幕
Write VBA in Excel, connect to Oracle and query the contents in the database
Create an int type array with a length of 6. The values of the array elements are required to be between 1-30 and are assigned randomly. At the same time, the values of the required elements are diffe
Can flycdc use SqlClient to specify mysqlbinlog ID to execute tasks
根据热门面试题分析Android事件分发机制(一)
IIS redirection redirection appears eurl axd
大佬们,有没有遇到过flink cdc读MySQLbinlog丢数据的情况,每次任务重启就有概率丢数
flex弹性布局
2020浙江省赛
How to solve the problem of golang select mechanism and timeout
CMD startup software passes in parameters with spaces
Unity uses mesh to realize real-time point cloud (II)
[4g/5g/6g topic foundation-146]: Interpretation of white paper on 6G overall vision and potential key technologies-1-overall vision
12、 Sort
C# Socke 服务器,客户端,UDP
CSDN salary increase technology - learn about the use of several common logic controllers of JMeter
PostgreSQL reports an error when creating a trigger,