摘要: p275 d(i)是以Ai为结尾的最长上升子序列的长度 《算法竞赛入门经典-训练指南》p62 问题6 提供了一种优化到 O(nlogn)的方法。 文本中用g(i)表示d值为i的最小状态编号(数组下标),满足 g(1) <= g(2) <= g(3) <= ... <= g(n) 可以用反证法: 假设 阅读全文
posted @ 2016-08-22 17:48 PatrickZhou 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 背包9讲 http://cuitianyi.com/ https://github.com/tianyicui/pack 刘汝佳 9.3.2 01背包的两种递推公式都是基于对第i件物品的策略(放或不放) 第2种递推 用f(i,j)表示“把前i个物品装到容量为j的背包中的最大总重量”,其状态转移方程也 阅读全文
posted @ 2016-08-18 13:58 PatrickZhou 阅读(371) 评论(0) 推荐(0) 编辑
摘要: #define _CRT_SECURE_NO_WARNINGS #include #include #include using namespace std; // 参考 http://blog.csdn.net/u014800748/article/details/43735015 // 题目中的条件是 n 种, 而例题嵌套矩形中的条件是 n 个 // n 种 block 不限供... 阅读全文
posted @ 2016-08-16 19:27 PatrickZhou 阅读(131) 评论(0) 推荐(0) 编辑
摘要: www.tup.tsinghua.edu.cn/upload/books/yz/055687-01.doc bing搜索UVa437 搜到这个word版本的电子书第9章 阅读全文
posted @ 2016-08-15 10:12 PatrickZhou 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #define _CRT_SECURE_NO_WARNINGS #include #include int min(int a, int b) { if (a = 1; j--) { // station N-1, N-2, ..., 1; j is the station number // start + t[j] is the time t... 阅读全文
posted @ 2016-08-12 11:03 PatrickZhou 阅读(123) 评论(0) 推荐(0) 编辑
摘要: int INF = -(1= V[j]) maxv[i] = max(maxv[i], dp(i-V[j]) + 1); return maxv[i]; } printf("%d\n", dp[S]); // 递推 maxv[0] = 0; for(int i = 1; i = V[j]) maxv[i] = max(maxv[i]... 阅读全文
posted @ 2016-08-10 17:32 PatrickZhou 阅读(121) 评论(0) 推荐(0) 编辑
摘要: http://www.freeclassicaudiobooks.com/audiobooks/Pride/mp3/pridemp3.htm 阅读全文
posted @ 2016-07-27 20:37 PatrickZhou 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 计算power的算法说明 http://www.sxt.cn/u/324/blog/2112 翻译自 http://videlalvaro.github.io/2014/03/the-power-algorithm.html 1.快速求幂算法 在这篇文章我会展示怎样通过求一个数的幂的基本思路,来引导 阅读全文
posted @ 2016-07-26 13:53 PatrickZhou 阅读(161) 评论(0) 推荐(0) 编辑
摘要: #define _CRT_SECURE_NO_WARNINGS #include using namespace std; int main() { int w[6]; int h[6]; while (scanf("%d%d", &w[0], &h[0])){ for (int i = 1; i h[i]){ ... 阅读全文
posted @ 2016-07-25 20:45 PatrickZhou 阅读(106) 评论(0) 推荐(0) 编辑
摘要: #define _CRT_SECURE_NO_WARNINGS #include #include #include #include using namespace std; int main() { string s, t; while (cin >> s >> t) { int sLen = s.length(); ... 阅读全文
posted @ 2016-07-25 19:23 PatrickZhou 阅读(122) 评论(0) 推荐(0) 编辑