DP
KLFTESPACE
这个作者很懒,什么都没留下…
展开
-
1045 Favorite Color Stripe (30分)
1.最长公共子序列#include<bits/stdc++.h>using namespace std;int main() { int n, m, l; cin >> n >> m; int a[m]; for(int i=1; i<=m; i++) { cin >> a[i]; } cin >>...原创 2020-02-18 15:34:55 · 131 阅读 · 0 评论 -
1007 Maximum Subsequence Sum (25 分)
//特殊情况 为负值即输出开头结尾即可#include<iostream>#include<cstdio>using namespace std;const int inf = 0x3f3f3f3f;const int N = 10000+5;int main() { int n, ans =-inf; cin >> n; ...原创 2019-10-18 23:18:19 · 98 阅读 · 0 评论 -
Piggy-Bank HDU - 1114
//完全背包#include<iostream>#include<cstdio>#include<cstring>#include<cstdlib>#include<algorithm>using namespace std;const int N = 500+5;const int M = 10000+5;c...原创 2019-09-06 17:39:14 · 88 阅读 · 0 评论 -
Monkey and Banana HDU - 1069
//贪心#include<cstdio>#include<algorithm>using namespace std;struct Brick{ int x,y,z;//长宽高 }brick[200];int ant;void UpDate(int x,int y,int z){ brick[ant].x = x; brick[ant]...原创 2019-09-06 15:32:43 · 110 阅读 · 0 评论 -
Bridge UVA-10037(WA)
类似Crossing River POJ-1700 不过还需要输出策略.....然后 可能有多种策略 WA了》。。。还不明白哪错了//WA(二)#include<iostream>#include<algorithm>using namespace std;int main(){ int T, n; cin >> T; ...原创 2019-03-24 22:30:56 · 149 阅读 · 0 评论 -
Crossing River POJ-1700
#include<iostream>#include<algorithm>using namespace std;int main(){ int T, n; cin >> T; while(T--){ cin >> n; int a[n+5]; int dp[n+5]; for(int i=1; i<=n; ...原创 2019-03-24 21:41:16 · 133 阅读 · 0 评论 -
Bone Collector HDU - 2602
#include <iostream>#include <cstdio>#include <cstring>#include <cmath>using namespace std;struct Pack{ int cost; int vol;};int dp[1000+5][1000+5];Pack a[1000...原创 2018-12-02 21:47:59 · 122 阅读 · 0 评论 -
有趣的数
201312-4 试题名称: 有趣的数 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 我们把一个数称为有趣的,当且仅当: 1. 它的数字只包含0, 1, 2, 3,且这四个数字都出现过至少一次。 2. 所有的0都出现在所有的1之前,而所有的2都出现在所有的3之前。 3. 最...原创 2018-11-12 20:22:43 · 232 阅读 · 0 评论 -
DP模板
//Dpint getMinSteps(int object, int floor){ if(object < 1 || floor < 1) { return 0; } int (*c)[floor+1] = new int[object+1][floor+1]; for(int i=1; i<object; i+...原创 2018-08-29 11:14:46 · 301 阅读 · 0 评论 -
算法训练 拦截导弹
问题描述 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统。但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能高于前一发的高度。某天,雷达捕捉到敌国的导弹来袭。由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹。 输入导弹依次飞来的高度(雷达给出的高度数据是不大于30000的正整数),计算这套系统最多能拦截多少导弹,如果要...原创 2018-08-30 20:04:28 · 311 阅读 · 0 评论