dfs(7.27)
qq_39479426
井底之蛙
展开
-
HihoCoder - 1049
描述在参与过了美食节之后,小Hi和小Ho在别的地方又玩耍了一阵子,在这个过程中,小Ho得到了一个非常有意思的玩具——一棵由小球和木棍连接起来的二叉树!小Ho对这棵二叉树爱不释手,于是给它的每一个节点都标记了一个标号——一个属于A..Z的大写字母,并且没有任意两个节点的标号是一样的。小Hi也瞅准了这个机会,重新巩固了一下小Ho关于二叉树遍历的基础知识~就这样,日子安稳的过了两天。这天,小...原创 2018-07-27 23:39:03 · 113 阅读 · 0 评论 -
CSU1960
有一棵由N个结点构成的树,每一条边上都有其对应的权值。现在给定起点,求从该点出发的一条路径(至少有一条边)使得这条路径上的权值之和最大,并输出这个最大值。Input第一行一个正整数T,代表数据组数。每组数据第一行两个正整数n(2<=n<=10^5),s(1<=s<=n),分别表示树结点数目以及给定的起点,点的编号从1至N。接下来M行,每行三个整数x,y,z,(1&l...原创 2018-07-27 23:44:56 · 117 阅读 · 0 评论 -
HDU2553
在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample Input...原创 2018-07-27 23:48:10 · 76 阅读 · 0 评论 -
HDU1016
A ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.Note: the number of f...原创 2018-07-27 23:58:11 · 333 阅读 · 0 评论 -
CSU2087
As is known to all, Wells doesn't have a good command of English. As a result, some unfamiliar words, which may cause sadness of Wells, is called tragedy words. In more detail, a word will be defined ...原创 2018-07-28 00:03:17 · 135 阅读 · 0 评论 -
HDU1035
A robot has been programmed to follow the instructions in its path. Instructions for the next direction the robot is to move are laid down in a grid. The possible instructions areN north (up the pag...原创 2018-07-28 00:06:22 · 262 阅读 · 0 评论 -
POJ3620
Farmer John's farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, however, an amou...原创 2018-07-28 00:08:09 · 145 阅读 · 0 评论 -
HDU1455
George took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot how many sticks he had orig...原创 2018-07-28 00:09:24 · 212 阅读 · 0 评论