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 · 1118 阅读 · 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 · 238 阅读 · 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 · 200 阅读 · 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 · 222 阅读 · 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 · 681 阅读 · 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 · 205 阅读 · 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 · 201 阅读 · 0 评论 -
SDUT - 数字三角形问题
数字三角形问题 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Description 给定一个由n行数字组成的数字三角形如下图所示。试设计一个算法,计算出从三角形的顶至底的一条路径,使该路径经过的数字总和最大。 对于给定的由n行数字组成的数字三角形,计算从三角形的顶至底的路径经...原创 2018-08-10 20:57:08 · 430 阅读 · 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 · 277 阅读 · 0 评论
分享