![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DP
ToheartZhang
这个作者很懒,什么都没留下…
展开
-
SDSC 2017 Day 4 T3 Lift
//dp[i][j]表示从i层出发还剩j次坐电梯的方案数 #include<bits/stdc++.h> using namespace std; const int moder = 1e9 + 7; int n, a, b, k; long long sum[5010], start, end; int dp[5012][2];inline int read(){ int num = 0原创 2017-08-25 09:31:09 · 250 阅读 · 0 评论 -
SDSC 2017 Day 5 T3
//dp1[i]是以i结尾的最长下降子序列的长度 //dp2[i]是以i结尾的...的方案数 #include<bits/stdc++.h> using namespace std; const int maxn = 5010; int n, ans, tot; int dp1[maxn], dp2[maxn], a[maxn];int main(){ scanf("%d", &n);原创 2017-08-25 12:06:09 · 273 阅读 · 0 评论 -
CodeVS 3012 & 3037 线段覆盖4 & 5
//dp[i]表示到枚举完i时的最优解 //二分找前面的线段进行转移 //!!!二分时将符合的答案先记下来以备作为结果,以l为答案会错 #include<bits/stdc++.h> using namespace std; const int maxn = 1000010; int n; long long dp[maxn];struct node{ long long l, r;原创 2017-08-26 22:04:34 · 262 阅读 · 0 评论 -
HAOI 2008 木棍分割
//需要优化很多的DP,包括预处理前缀和,滚动数组,预处理可转移状态 #include<bits/stdc++.h> using namespace std; const int moder = 10007; const int maxn = 50010; const int inf = 0x3f3f3f3f; int n, m, tmp; int f[maxn], a[maxn], last[m原创 2017-08-28 10:59:18 · 338 阅读 · 0 评论 -
暑末 Day1 Face
//伪概率DP #include<bits/stdc++.h> using namespace std; int hm, high, low, n, m, c, a, b, t; int delta; double dp[810][16001], sum[16001];inline int read(){ int num = 0; char c; while((c = get原创 2017-08-28 11:23:23 · 227 阅读 · 0 评论 -
洛谷 2014 选课
//dp[i][j]是以i为根不算i的子树选j门课的学分 #include<bits/stdc++.h> using namespace std; const int maxn = 3030; int n, m, tot = 0; int dp[maxn][maxn], st[maxn], a[maxn]; struct node{ int v, w, nxt; } edge[maxn];原创 2017-08-28 17:49:03 · 480 阅读 · 0 评论 -
暑末 Day2 T3
//maxd表示根到叶子的最大距离 //预处理maxd,即知需修改的长度 //to != fa #include<bits/stdc++.h> using namespace std; const int maxn = 500000;//// const int inf = 0x3f3f3f3f; int n, tot, ans; int st[maxn], out[maxn], dep[max原创 2017-08-29 17:28:24 · 307 阅读 · 0 评论