http://acm.hdu.edu.cn/showproblem.php?pid=4725求1-n最短路,每个点有一个层数,相邻层之间花费k可以到达建图时把层数看成n个点,层到该层点距离为0,点到其相邻层距离为c,相邻层之间距离为c#include
#include #include #inclu...
分类:
其他好文 时间:
2014-05-23 09:33:47
阅读次数:
339
http://acm.hdu.edu.cn/showproblem.php?pid=3746kmp的Nxet数组求字符串循环节例题lenB%(lenB-Next[lenB])==0则其有周期lenB/(lenB-Next[lenB]),其中最小循环节长度是lenB-Next[lenB]#includ...
分类:
其他好文 时间:
2014-05-21 19:36:29
阅读次数:
185
http://acm.hdu.edu.cn/showproblem.php?pid=1358求某个前缀的周期,用Next求循环节的题目#include
#include #include #include using namespace std ;char B[1000005] ;int Next[...
分类:
其他好文 时间:
2014-05-21 19:23:01
阅读次数:
241
http://acm.hdu.edu.cn/showproblem.php?pid=4635问:最多加多少条边,使得原图不是强连通图正向考虑有困难,不妨反向思考,既最少去掉几条边使得原图不是强连通。总边数sum=n*(n-1)时肯定是强连通,已经给了m条边,sum-=m这时把已经强连通的部分进行缩点...
分类:
其他好文 时间:
2014-05-14 13:37:36
阅读次数:
335
http://acm.hdu.edu.cn/showproblem.php?pid=3309
1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7
8 char s[30][3...
分类:
其他好文 时间:
2014-05-09 07:52:24
阅读次数:
328
http://acm.hdu.edu.cn/showproblem.php?pid=30622sat判定性问题模板#include #include
#include #include #include #include using namespace std ;struct node { i...
分类:
其他好文 时间:
2014-05-08 19:24:07
阅读次数:
363
http://acm.hdu.edu.cn/showproblem.php?pid=3667最小费用最大流本题流量和费用不是线性关系,fee=a*flow*flow,所以常规套模板spfa无法得到最小费用观察到每条边流量上限只有5,则可以把一条流量为f的边拆成f条流量为1的边,每条边费用是a*(2*...
分类:
其他好文 时间:
2014-05-08 05:17:36
阅读次数:
329
敌兵布阵Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 37903 Accepted
Submission(s): 15985 Problem ...
分类:
其他好文 时间:
2014-05-07 17:52:06
阅读次数:
317
http://acm.hdu.edu.cn/showproblem.php?pid=2292题意:1-n个节点,题目给出了完全二叉树的定义(这个定义似乎有歧义,此题以题目描述为准),且要保持最小堆性质(根节点小于左右子树内的任意元素),问有多少种不同组合解法:dp,dp[n]表示n个元素的合法排列数...
分类:
其他好文 时间:
2014-05-07 16:58:58
阅读次数:
300
Integer InquiryTime Limit: 2000/1000 MS
(Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s):
11678Accepted Submission(s): 2936Pr...
分类:
其他好文 时间:
2014-05-06 00:44:43
阅读次数:
355