![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
递归
~VEGETABLEBIRD~
这个作者很懒,什么都没留下…
展开
-
P1331 海战
思路非常的简单,先判断是否合法,再用dfs #include<iostream> #include<cstdio> #include<cstring> using namespace std; int r, c; char map[1010][1010]; int fx[4] = { 0,-1,1,0 }; int fy[4] = { -1,0,0,1 }; int dfs(int x, int y) { map[x][y] = '*'; for (int i = 0原创 2020-05-15 16:04:48 · 271 阅读 · 0 评论 -
洛谷——P1259 黑白棋子的移动
不知道最后四行的规律,就只好这样了… #include<iostream> using namespace std; int n; char a[210]; void print() { for (int i = 1; i <= 2 * n + 2; i++) { cout << a[i]; } cout << endl; } void prin...原创 2020-04-27 20:25:17 · 312 阅读 · 0 评论 -
循环日程表问题
题干:2^k个球员进行网球循环赛,需要设计比赛日程表。比赛共进行n-1天。每个选手一天只能赛一次,每个选手必须与其他选手各赛一次。 解决:非常简单的一道递归问题。 #include<iostream> #include<cmath> using namespace std; const int maxn = 5000; int k; int map[maxn][maxn];...原创 2020-03-27 15:41:18 · 508 阅读 · 0 评论