![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DFS
文章平均质量分 76
qq_41555192yl
吾往矣...
展开
-
Happy Path
Sample Input 1 13 21 23 2Sample Output 12解析:其实我们只需要求得每个节点的“儿子”有多少个,然后把它们相加即可,结果是:0+1+2+0+4+3=10;例如:以下过程按代码进行模拟:son [ 6 ] = 0; dp[ 6 ] = 0; ...原创 2018-08-31 12:44:31 · 1520 阅读 · 0 评论 -
H — Color ring(dfs)
Sample Input 1 3 4 AAAA ABCA AAAASample Output 1 Yes解析:题目中给的n、m的范围是0~50,所以可以直接暴力枚举,把所有点都遍历一遍,用 flag 标记是否有环出现,一旦 flag==1,跳出所有循环,难点是如何找环,其实只需要那开始dfs的点,和遍历到最后的...原创 2018-08-28 18:14:04 · 119 阅读 · 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 · 140 阅读 · 0 评论 -
C - Oil Deposits (DFS)
网址:https://vjudge.net/contest/241948#problem/CThe 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 · 148 阅读 · 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 · 134 阅读 · 0 评论 -
A - Red and Black (bfs || dfs)
网址:https://vjudge.net/contest/241948#problem/AThere 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 · 142 阅读 · 0 评论 -
B — 问题
Sample Input 1 23 5 6 11 2 34 40 50 1010 20 30 25Sample Output 122题意:找符合题意的问题集的数量;例如:5 <= 1+2+3 <=6 ; 5 <= 2+3 <=6 ; 故问题集的数量为2;两种方法,而且n的最大值是10,dfs和状态压缩都可以;...原创 2018-09-01 22:44:07 · 390 阅读 · 0 评论