上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 47 下一页

2014年5月30日

摘要: http://acm.xmu.edu.cn/JudgeOnline/problem.php?id=1246求区间内素数个数,经典问题,区间长度10^6,数的取值最多能到10^12(此题范围稍小)用筛法搞出[2,根号b]范围内的素数,用这些素数再去筛[a,b]一个吐血的trick,1不是素数#incl... 阅读全文
posted @ 2014-05-30 18:56 LegendaryAC 阅读(206) 评论(0) 推荐(0) 编辑

2014年5月21日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2255km模板,二分图最优匹配,复杂度O(n^3)http://www.cnblogs.com/jackge/archive/2013/05/03/3057028.html#include #include #in... 阅读全文
posted @ 2014-05-21 15:24 LegendaryAC 阅读(221) 评论(0) 推荐(0) 编辑

2014年5月20日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1358求某个前缀的周期,用Next求循环节的题目#include #include #include #include using namespace std ;char B[1000005] ;int Next[... 阅读全文
posted @ 2014-05-20 21:35 LegendaryAC 阅读(140) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3746kmp的Nxet数组求字符串循环节例题lenB%(lenB-Next[lenB])==0则其有周期lenB/(lenB-Next[lenB]),其中最小循环节长度是lenB-Next[lenB]#includ... 阅读全文
posted @ 2014-05-20 21:14 LegendaryAC 阅读(369) 评论(0) 推荐(0) 编辑
 
摘要: http://codeforces.com/problemset/problem/432/D在前缀是后缀的前提下,求这个前缀在原串中出现了多少次出现的次数可以用dp求解,前缀是后缀直接用Next判断,较为综合的kmp考察,这题没写出来就是kmp基础不牢,不应该#include #include #i... 阅读全文
posted @ 2014-05-20 20:14 LegendaryAC 阅读(310) 评论(0) 推荐(0) 编辑

2014年5月19日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4725求1-n最短路,每个点有一个层数,相邻层之间花费k可以到达建图时把层数看成n个点,层到该层点距离为0,点到其相邻层距离为c,相邻层之间距离为c#include #include #include #inclu... 阅读全文
posted @ 2014-05-19 23:54 LegendaryAC 阅读(232) 评论(0) 推荐(0) 编辑

2014年5月16日

摘要: LabyrinthTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 519 Accepted Submission(s): 174Proble... 阅读全文
posted @ 2014-05-16 16:54 LegendaryAC 阅读(548) 评论(0) 推荐(0) 编辑
 
摘要: hdu2222 字符串多模匹配算法 采用kuangbin模板#include #include #include #include #include using namespace std;struct Trie{ int next[500010][26],fail[500010],end[5... 阅读全文
posted @ 2014-05-16 14:16 LegendaryAC 阅读(182) 评论(0) 推荐(0) 编辑

2014年5月14日

摘要: 数组下标0-n-1,询问区间最值int dp[100005][20];void makermq(int n, int *a) { for(int i = 0; i < n; i++) dp[i][0] = a[i]; for(int j = 1; (1<<j) <= n; ... 阅读全文
posted @ 2014-05-14 19:11 LegendaryAC 阅读(104) 评论(0) 推荐(0) 编辑

2014年5月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4635问:最多加多少条边,使得原图不是强连通图正向考虑有困难,不妨反向思考,既最少去掉几条边使得原图不是强连通。总边数sum=n*(n-1)时肯定是强连通,已经给了m条边,sum-=m这时把已经强连通的部分进行缩点... 阅读全文
posted @ 2014-05-13 23:30 LegendaryAC 阅读(775) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 47 下一页