
dp动态规划
blue_cgt
这个作者很懒,什么都没留下…
展开
-
线性dpPOJ - 1745
Consider an arbitrary sequence of integers. One can place + or - operators between integers in the sequence, thus deriving different arithmetical expressions that evaluate to different values. Let us,...原创 2018-03-29 07:19:58 · 128 阅读 · 0 评论 -
牛客多校__free
链接:https://ac.nowcoder.com/acm/contest/884/J来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述Your are given an undirect connected graph.Every edge has a cos...原创 2019-07-30 11:44:19 · 240 阅读 · 0 评论 -
牛客多校__number
链接:https://ac.nowcoder.com/acm/contest/884/K来源:牛客网题目描述300iq loves numbers who are multiple of 300.One day he got a string consisted of numbers. He wants to know how many substrings in the str...原创 2019-07-29 11:11:19 · 259 阅读 · 0 评论 -
牛客多校__Equivalent Prefixes
链接:https://ac.nowcoder.com/acm/contest/881/A来源:牛客网时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述Two arrays u and v each with m distinct elements are called equ...原创 2019-07-19 11:19:52 · 116 阅读 · 0 评论 -
牛客网多校__ ABBA
链接:https://ac.nowcoder.com/acm/contest/881/E来源:牛客网时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述Bobo has a string of length 2(n + m) which consists of characte...原创 2019-07-19 09:40:06 · 175 阅读 · 0 评论 -
神
https://acm.uestc.edu.cn/status/78088设dp[i][j]表示当前处理到第i块, 第i块的末尾放第i块中的第j个字母 的时候,1~i块之间的段数.转移时枚举i-1块的结尾l和i块结尾j,如果i块 没有这个l,那么dp[i][j]只能是dp[i-1][l]加 上第i块的所有不同字母数 否则,可以把第i块的l放到第一段,这样 dp[i][j]=dp[...原创 2019-07-07 14:30:33 · 169 阅读 · 0 评论 -
子串
https://acm.uestc.edu.cn/problem/zi-chuan/description用滚动数组做,然后dp[i][j] i表示以第i个为结尾的余数为j的方案数#include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 1e7+9;...原创 2019-07-07 13:00:46 · 130 阅读 · 0 评论 -
序列
https://acm.uestc.edu.cn/problem/xu-lie/descriptionnlog的求最长子序列,理解自己去百度下#include <bits/stdc++.h>using namespace std;typedef long long ll;const int maxn = 1e6+9;int a[maxn];int nn[m...原创 2019-07-07 11:08:57 · 172 阅读 · 0 评论 -
uestc__oy环游世界
https://acm.uestc.edu.cn/problem/oyhuan-you-shi-jie/description状压dp由n=17可以知道是状压dp,然后推出转移方程dp[now][st] 为当前以now结尾且状态为st故 dp[i][st|1<<(i-1)] = min(dp[i][st|1<<(i-1)],dp[now][st]+d...原创 2019-07-06 23:26:17 · 216 阅读 · 0 评论 -
双倍快乐
https://www.cometoj.com/contest/48/problem/B?problem_id=2278二维dp#include <bits/stdc++.h>using namespace std;const int maxn = 5e2+9;int dp[maxn][maxn];int a[maxn];int main(){ ...原创 2019-06-30 14:50:21 · 332 阅读 · 0 评论 -
牛客多校__subsequence 1
链接:https://ac.nowcoder.com/acm/contest/885/G来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述You are given two strings s and t composed by digits (characters...原创 2019-08-04 17:13:08 · 183 阅读 · 0 评论