
----基础算法----
acunstoppable
这个作者很懒,什么都没留下…
展开
-
POJ1065 动态规划 LIS
题意: 求偏序集链的最小划分数。 思路: 1、贪心; 2、利用Dilworth定理转化成LIS模型。 反思: Dilworth定理:偏序集中链的最小划分数 = 最长反链长度。 代码: 1、贪心#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 5原创 2018-03-16 00:35:21 · 206 阅读 · 0 评论 -
CF917A 思维题
题意: codeforces 917A Monster 思路:First, let's denote s[l..r] as the substring slsl + 1... sr of string s. Also s.count(t) is the number of occurrences of t in s.A string consisting of parentheses and q原创 2018-01-31 00:25:29 · 387 阅读 · 1 评论 -
HDU1257 贪心
题意:求一数列中最少有多少个不递增子序列。 思路: 1、定义dp[i]为第i个拦截系统的所能打到的最低高度 2、用贪心思想,每次用离导弹最近且可打到的拦截系统,如若没有,则动用新的拦截系统。 反思: 1、由于这题被划分到了动态规划的专题,所以刚开始一直想用LIS做,但是只能想到复杂度过高的算法。后来一经提醒是贪心,则马上秒掉了…#include <iostream>using names原创 2017-08-12 21:50:26 · 162 阅读 · 0 评论