![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
dfs
live4m
老菜逼了
展开
-
CodeForces 1287 D.Numbers on Tree (dfs)
D.Numbers on Tree Evlampiy was gifted a rooted tree. The vertices of the tree are numbered from 1 to n. Each of its vertices also has an integer ai written on it. For each vertex i, Evlampiy calculate...原创 2020-01-15 15:18:44 · 447 阅读 · 0 评论 -
CodeForces - 377 A.Maze (dfs回溯)
A.Maze Pavel loves grid mazes. A grid maze is an n × m rectangle maze where each cell is either empty, or is a wall. You can go from one cell to another only if both cells are empty and have a common ...原创 2019-10-27 23:44:44 · 226 阅读 · 0 评论 -
hdu 2266 How Many Equations Can You Find (dfs)
hdu2266 问题描述 现在给出一个只包含0、1、2、3、4、5、6、7、8、9的字符串。要求您在字符之间添加“+”或“-”符号。就像给你一个字符串“12345”,你可以算出一个字符串“123+4-5”。现在给你一个整数N,请告诉我你能找到多少种方法使字符串的结果等于N,你最多只能在两个相邻的字符中选择一个符号。 输入 每种情况都包含一个字符串s和一个数字N。您可以确保字符串的长度不会超过12,...原创 2019-06-11 10:45:43 · 211 阅读 · 0 评论 -
poj3172 Scales (dfs+前缀和剪枝)
Scales Farmer John has a balance for weighing the cows. He also has a set of N (1 <= N <= 1000) weights with known masses (all of which fit in 31 bits) for use on one side of the balance. He pla...原创 2019-08-09 21:34:22 · 276 阅读 · 0 评论 -
CodeForces - 1214 D.Treasure Island (dfs)
题意: 给一个二维字符串图,大小为nm #表示墙 。表示路 问最小添加几个墙可以使得从(1,1)到(n,m)没有路 Examples Input 2 2 … … Output 2 Input 4 4 … #.#. … .#… Output 1 Input 3 4 … .##. … Output 2 分析: 答案最多为2,把(1,1)堵住或者(n,m)堵住 从起点dfs且标记路径,如果到不了终点则不...原创 2019-09-05 22:31:10 · 271 阅读 · 0 评论