![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
DP
Miracle_QSH
这个作者很懒,什么都没留下…
展开
-
CodeForces - 1084C The Fair Nut and String(简单DP)
题目链接:https://cn.vjudge.net/problem/CodeForces-1084C题目大意:给你一个由小写字母组成的字符串 s ,让你找一种序列:1、对于任意一个 i ,使得 s[ p[ i ] ] == 'a'2、对于任意一个 i ,存在 p[ i ] < j < p[i + 1],且s[ p[ i ] ] == 'b'求这种序列有多少个,答案...原创 2018-12-12 20:12:52 · 970 阅读 · 0 评论 -
UVA - 12186 Another Crisis (树形DP)
题目链接:UVA - 12186 Another Crisis#include <bits/stdc++.h>using namespace std;int n, t;vector<int> son[100005];int dp(int u){ if(son[u].empty())return 1; int k = son[u].size()...原创 2018-08-13 09:36:05 · 148 阅读 · 0 评论 -
UVA - 11584 Partitioning by Palindromes (线性结构上的动态规划)
题目连接:UVA - 11584 Partitioning by Palindromes #include <bits/stdc++.h>using namespace std;char s[1005];int dp[1005];int check(int l, int r){ while(l<r){ if(s[l] != s[r]) ret...原创 2018-08-12 20:14:20 · 139 阅读 · 0 评论 -
UVA - 11400 Lighting System Design (线性结构上的动态规划)
题目链接:UVA - 11400 Lighting System Design#include <bits/stdc++.h>using namespace std;struct node{ int v, k, c, l;}a[1005];int s[1005], dp[1005];bool cmp(struct node a, struct node b)...原创 2018-08-11 20:50:58 · 162 阅读 · 1 评论 -
*UVA - 1347 Tour (DAG上的动态规划)
题目链接:UVA - 1347 Tour#include <bits/stdc++.h>using namespace std;struct node{ double x, y;}a[1005];double dis(int i, int j){ return sqrt((a[i].x - a[j].x) * (a[i].x - a[j].x) + (...原创 2018-08-11 10:36:24 · 563 阅读 · 0 评论 -
UVA - 437 The Tower of Babylon(DAG上的动态规划)
题目链接:UVA - 437 The Tower of Babylon#include <cstdio>#include <cstring>#include <algorithm>#include <iostream>using namespace std;struct node{ int x, y, z;}a[10005...原创 2018-08-11 09:51:35 · 140 阅读 · 0 评论 -
UVA - 1025 A Spy in the Metro (DAG上的动态规划)
题目链接:UVA - 1025 A Spy in the Metro#include <bits/stdc++.h>using namespace std;int s[55][55], a[12500][55][5], dp[255][55];int n, T, M1, M2, i, j, k, ans, num = 1;void init(){ memset(...原创 2018-08-11 09:42:38 · 146 阅读 · 0 评论 -
SDUT - 数字三角形问题
数字三角形问题Time Limit: 1000 ms Memory Limit: 65536 KiBSubmit Statistic DiscussProblem Description给定一个由n行数字组成的数字三角形如下图所示。试设计一个算法,计算出从三角形的顶至底的一条路径,使该路径经过的数字总和最大。 对于给定的由n行数字组成的数字三角形,计算从三角形的顶至底的路径经...原创 2018-08-10 20:57:08 · 359 阅读 · 0 评论 -
HDU - 2089 不要62(数位DP)
模板题 #include <bits/stdc++.h>using namespace std;typedef long long ll;ll a[15];ll dp[15][2];ll dfs(ll pos, ll sta, ll lim){ if(pos == -1)return 1; if(lim == 0 && dp[pos][...原创 2018-12-12 20:59:55 · 208 阅读 · 0 评论