
DFS
文章平均质量分 76
qq_41555192yl
吾往矣...
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Happy Path
Sample Input 1 1 3 2 1 2 3 2 Sample Output 1 2 解析:其实我们只需要求得每个节点的“儿子”有多少个,然后把它们相加即可,结果是:0+1+2+0+4+3=10; 例如: 以下过程按代码进行模拟: son [ 6 ] = 0; dp[ 6 ] = 0; ...原创 2018-08-31 12:44:31 · 1650 阅读 · 0 评论 -
H — Color ring(dfs)
Sample Input 1 3 4 AAAA ABCA AAAA Sample Output 1 Yes 解析: 题目中给的n、m的范围是0~50,所以可以直接暴力枚举,把所有点都遍历一遍,用 flag 标记是否有环出现, 一旦 flag==1,跳出所有循环,难点是如何找环,其实只需要那开始dfs的点,和遍历到最后的...原创 2018-08-28 18:14:04 · 143 阅读 · 0 评论 -
codeforces 915C - Permute Digits(DFS)
辞树的最大数 Description 给出两个整数a和b,对于数字a可以无限次更换两个数位上的数字以构造不超过b的最大数。 Input 输入: 第一行输入一个整数 T(0<T<11),代表有T组数据。 每行输入两个整数 a,b (0<a,b < 1e18) Output 输出: 打印最大可能的数字,该数字是a的数字排列并且不大于b。 每...原创 2018-08-13 18:28:25 · 177 阅读 · 0 评论 -
C - Oil Deposits (DFS)
网址:https://vjudge.net/contest/241948#problem/C The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of la...原创 2018-08-01 23:01:57 · 180 阅读 · 0 评论 -
B - Tempter of the Bone (DFS)
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone ...原创 2018-08-01 22:57:18 · 159 阅读 · 0 评论 -
A - Red and Black (bfs || dfs)
网址:https://vjudge.net/contest/241948#problem/A There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can...原创 2018-08-01 22:49:54 · 179 阅读 · 0 评论 -
B — 问题
Sample Input 1 2 3 5 6 1 1 2 3 4 40 50 10 10 20 30 25 Sample Output 1 2 2 题意:找符合题意的问题集的数量; 例如:5 <= 1+2+3 <=6 ; 5 <= 2+3 <=6 ; 故问题集的数量为2; 两种方法,而且n的最大值是10,dfs和状态压缩都可以; ...原创 2018-09-01 22:44:07 · 418 阅读 · 0 评论