http://acm.hdu.edu.cn/showproblem.php?pid=1269Tarjan的强连通算法:对于每一个点有一个编号DFN和能往上一步的最小点的编号LOW在进行深搜时,对于每一个节点都有一个编号假定现在定点为u深搜时有两种情况1.v没有被搜过,继续搜,LOW[u] = min...
分类:
其他好文 时间:
2015-09-09 21:16:32
阅读次数:
143
题目传送门题意:判断是否为哈密顿图分析:首先一种情况是不合法的:也就是度数为1的点超过2个;合法的有:,那么从度数为1的点开始深搜,如果存在一种走法能够走完n个点那么存在哈密顿路收获:学习资料代码:/************************************************* ...
分类:
其他好文 时间:
2015-09-05 17:37:42
阅读次数:
155
链接:http://poj.org/problem?id=1321Time Limit:1000MSMemory Limit:10000KTotal Submissions:28899Accepted:14307Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区...
分类:
其他好文 时间:
2015-09-05 09:51:17
阅读次数:
158
题意:给一个n×n的棋盘,#是可以放棋子的地方,棋子每行每列只能有一个,问放k个棋子的方案数。解法:按行深搜,标记一下列就行了。代码:#include#include#include#include#include#include#include#include#include#include#in...
分类:
其他好文 时间:
2015-09-01 21:31:55
阅读次数:
208
http://acm.hdu.edu.cn/showproblem.php?pid=5311Hidden StringTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 262144/262144 K (Java/Others)Total Subm...
分类:
其他好文 时间:
2015-09-01 13:57:30
阅读次数:
165
??
Description
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...
分类:
其他好文 时间:
2015-08-31 23:44:11
阅读次数:
278
??
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 nu...
分类:
其他好文 时间:
2015-08-31 17:27:11
阅读次数:
127
链接:http://hihocoder.com/problemset/problem/1224
//深搜一遍求最大深度,从最大深度的叶子回溯到根的所经过的每个顶点在深搜求最大深度
#include
#include
#include
#include
#include
#include
using namespace std;
const int maxn=100000+10;
...
分类:
其他好文 时间:
2015-08-31 17:23:13
阅读次数:
268
题目传送门题意:中文题面分析:放官方题解,就是从1为根节点深搜记录节点的深度,选出最大的深度的点,将该到达该点的节点都vis掉,然后再重新计算没有vis的点的深度,找最大的相加就是答案。放张图好理解:收获:计算树的节点的深度代码:/**********************************...
分类:
其他好文 时间:
2015-08-31 14:55:24
阅读次数:
127
??
Crawling in process...
Crawling failed Time Limit:1000MS
Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit
Status
Practice
HDU 1258
Description
Given a s...
分类:
其他好文 时间:
2015-08-31 11:56:30
阅读次数:
174