
DP
AliceBuJu
这个作者很懒,什么都没留下…
展开
-
【codevs 1058】合唱队形
正反两个方向求最长公共子序列。 PS:ans=max(ans,dp[k]+dp1[k]-1);减一的原因是因为k被记录了两遍。#include<cstdio> #include<cstring> #include<iostream> using namespace std; int n; const int maxn=100+5; int a[maxn],dp[maxn],dp1[maxn]; i原创 2017-09-27 20:20:01 · 455 阅读 · 0 评论 -
【codevs 1039】数的划分&&【Openjudge 666】放苹果
DFS 数的划分#include<cstdio> #include<iostream> #include<cmath> #include<cstring> using namespace std; int n,m; int cnt=0; void HF(int a,int b,int c) { if(b==1) { cnt++; return;原创 2017-10-14 21:24:44 · 522 阅读 · 0 评论 -
【POJ 1837】Balance
DP#include<cstdio> #include<iostream> #include<cstring> #include<algorithm> using namespace std; int c,g; const int maxn=21; int gm[maxn],gz[maxn]; int dp[maxn][15000+4]; int main() { scanf("%d%d",原创 2017-10-10 17:12:16 · 184 阅读 · 0 评论 -
【清北】【笔记】DP
线性动规原创 2017-10-03 10:53:20 · 253 阅读 · 0 评论 -
复习/学习DP的长记
01背包问题 采药 二维#include<cstdio> #include<iostream> #include<cstring> using namespace std; int t,m; const int maxn=1005; int v[maxn],tm[maxn],dp[maxn][maxn]; int main() { memset(v,0,sizeof(v));原创 2017-10-20 18:39:44 · 323 阅读 · 0 评论 -
中二病
题目描述 给出一篇包含英文字母、和空白字符(制表/空格/回车) 的文章, 忽略空白字符并且不区分大小写, 请计算出在这篇文章中“HelloWorld” 作为子序列出现的次数。 由于答案可能很大, 请输出结果对 1000000007(10^9+7)的余数。 输入描述 输入包含若干行, 这些行的内容共同构成一篇文章。 文章以 EOF(文件结尾)结束。 输出描述 输出仅包含一个整数,表示这篇文原创 2017-10-17 16:22:04 · 402 阅读 · 0 评论