![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
笔记
双非三本菜狗
这个作者很懒,什么都没留下…
展开
-
简单dfs学习
842. 排列数字 给定一个整数 n,将数字 1∼n 排成一排,将会有很多种排列方法。 现在,请你按照字典序将所有的排列方法输出。 输入格式 共一行,包含一个整数 n。 输出格式 按字典序输出所有排列方案,每个方案占一行。 数据范围 1≤n≤7 输入样例: 3 输出样例: 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1 #include<iostream> using namespace std; const int N =10; int path[N]; bool st原创 2021-05-19 22:37:49 · 63 阅读 · 1 评论 -
2021-05-06
#include <cstring> #include <iostream> #include <algorithm> #include <vector> using namespace std; const int N = 210, INF = 0x3f3f3f3f; int n, m; bool g[N][N]; //g[i][j]代表第i号村庄与第j号村庄相邻 bool vis[N];//当次状态 struct node { int ans;原创 2021-05-06 23:33:56 · 82 阅读 · 0 评论