算法->DP
文章平均质量分 72
ayu要努力
唯纯粹与热爱不可辜负。
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
ccf 201612-4 压缩编码 石子合并问题(DP+平行四边形优化)
学无止境~ 平行四边形优化为啥成立还在思考中~ //石子问题 平行四边形优化 #include #define maxn 1002 #define inf 0x3fffffff #define min(a,b) a<b?a:b using namespace std; int n; int a[maxn],dp[maxn][maxn],p[maxn][maxn],sum[maxn]; int原创 2017-09-07 00:06:00 · 353 阅读 · 0 评论 -
hdu1025 最长上升子序列 O(nlogn)优化版
这题坑点挺多。 首先,输入很大,虽然看懂了是最长上升子序列,但第一次用朴素查找,妥妥的超时了。。 学习一下二分查找LIS,可以优化到O(nlogn)。 还有就是英文输出时,一定要注意复数复数!!之前有道题也是用到各种数序的英文输出。不注意的话就会WA。 二分查找LIS,其实就是拿一个数组f[],下标表示长度,存放该长度序列的末尾数。该数组存放的末尾数也一定是递增的。 #inc原创 2017-09-06 16:41:22 · 355 阅读 · 0 评论 -
POJ1231 max sum sequences DP
最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34628 Accepted Submission(s): 15711 Problem Description 给定K个整数的序列{ N1, N原创 2017-09-16 01:38:38 · 545 阅读 · 0 评论 -
poj3624 基础01背包问题 闲来无事划划水啦~
Charm Bracelet Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41224 Accepted: 17934 Description Bessie has gone to the mall's jewelry store and spies a原创 2017-09-10 17:24:53 · 318 阅读 · 0 评论 -
poj3181 完全背包+整数拆分
Dollar Dayz Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7840 Accepted: 2922 Description Farmer John goes to Dollar Days at The Cow Store and discovers原创 2017-09-10 19:31:59 · 390 阅读 · 0 评论 -
POJ1276 多重背包
Cash Machine Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 36959 Accepted: 13408 Description A Bank plans to install a machine for cash withdrawal. The m原创 2017-09-10 20:55:25 · 304 阅读 · 0 评论 -
poj1458 LCS 基础dp
Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 54939 Accepted: 22901 Description A subsequence of a given sequence is the given sequenc原创 2017-09-12 10:03:13 · 220 阅读 · 0 评论 -
分段上升子序列,二次DP (poj1239)(留坑待完善。。。)
dp经典题。思路是对的但要改一下数据存储方式。。因为80个字符表示的数字int放不下。。。。 #include #include #include #include #define maxn 100 using namespace std; char a[maxn]; int len,last; int bk[maxn]; int v[maxn][maxn],front[max原创 2017-09-12 21:51:20 · 255 阅读 · 0 评论 -
poj2533 最最最基础的最长上升子序列 普通版+二分法版
Longest Ordered Subsequence Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 55298 Accepted: 24789 Description A numeric sequence of ai is ordered if a1 a2原创 2017-09-12 22:13:39 · 220 阅读 · 0 评论
分享