摘要: 问题: 拿POJ 2533来说。 Sample Input 71 7 3 5 9 4 8 Sample Output(最长上升/非降子序列的长度) 4 解法一(O(n^2)): 如何把这个问题分解成子问题呢?经过分析,发现 “求以ak(k=1, 2, 3…N)为终点的最长上升子序列的长度”是个好的子 阅读全文
posted @ 2016-09-16 19:31 Shiyu_Huang 阅读(722) 评论(0) 推荐(0)
摘要: main.cpp: #include <iostream>#include <vector>#include <cstring>#include <cstdio>#include <algorithm>#include <cmath> using namespace std; std::vector 阅读全文
posted @ 2016-09-16 18:34 Shiyu_Huang 阅读(459) 评论(0) 推荐(0)
摘要: 测例: 30 53 4 6 8 4 1 4 12 4 5 1234 34 54 213 12 3 6456 121 434 12 3 2 1234 234 234 45 1 34 6 2341 34 823 291 2513 29 #include <iostream>#include <vecto 阅读全文
posted @ 2016-09-16 18:15 Shiyu_Huang 阅读(166) 评论(0) 推荐(0)
摘要: 1.安装g++ 下载https://sourceforge.net/projects/mingw/files/Installer/mingw-get/mingw-get-0.6.2-beta-20131004-1/mingw-get-0.6.2-mingw32-beta-20131004-1-bin 阅读全文
posted @ 2016-09-16 13:55 Shiyu_Huang 阅读(237) 评论(0) 推荐(0)
摘要: 1.插入配对 std::vector<pair<int,int> > w; w.push_back(make_pair<int,int>(f,s) ); cout <<w[i].first << " " << w[i].second <<endl; 2.元素去重 std::vector<int> a 阅读全文
posted @ 2016-09-16 13:44 Shiyu_Huang 阅读(270) 评论(0) 推荐(0)