摘要:
适用于t[]串长度较小的情况,利用位运算一般比KMP算法快两倍以上。 用D来记录前缀的匹配情况,要使用Shift 算法,需要一个辅助表B。B 是一个字典,key 是问题域字符集中的每个字符,value 是一个n 位无符号整数,记录该字符在模式串T 的哪些位置出现。 由于D【j】表示的是T[0..J] 阅读全文
摘要:
The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, eac 阅读全文
摘要:
The binomial coefficient C(m, n) is defined as C(m, n) = m! (m − n)! n! Given four natural numbers p, q, r, and s, compute the the result of dividing 阅读全文
摘要:
https://vjudge.net/contest/176767#overview A - A Spy in the Metro B 最长递增子序列变形 C D E G H I I 树形DP 阅读全文
摘要:
3657 括号序列 我们用以下规则定义一个合法的括号序列: (1)空序列是合法的 (2)假如S是一个合法的序列,则 (S) 和[S]都是合法的 (3)假如A 和 B 都是合法的,那么AB和BA也是合法的 例如以下是合法的括号序列: (), [], (()), ([]), ()[], ()[()] 以 阅读全文
摘要:
3049 舞蹈家怀特先生 时间限制: 1 s 空间限制: 64000 KB 题目等级 : 黄金 Gold 题解 3049 舞蹈家怀特先生 3049 舞蹈家怀特先生 时间限制: 1 s 空间限制: 64000 KB 题目等级 : 黄金 Gold 时间限制: 1 s 空间限制: 64000 KB 题目等 阅读全文
摘要:
分数规划问题,是指这样一类问题: 要求f(x)/g(x)的最值,其中f(x),g(x)都是线性函数,而其中被研究的最多的是0-1分数规划,即求这样的一个式子的极值 r=(∑(ci*xi))/(∑(di*xi)),其中xi∈{0,1} 我们可以把这个式子变换一下 z=(∑(ci*xi))-r'*(∑( 阅读全文
摘要:
In the modern time, Search engine came into the life of everybody like Google, Baidu, etc. Wiskey also wants to bring this feature to his image retrie 阅读全文
摘要:
These are N cities in Spring country. Between each pair of cities there may be one transportation track or none. Now there is some cargo that should b 阅读全文
摘要:
Time Limit: 5000MS Memory Limit: 131072K Total Submissions: 115624 Accepted: 35897 Case Time Limit: 2000MS Description You have N integers, A1, A2, .. 阅读全文