上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 58 下一页
摘要: 题目链接:https://codeforces.com/problemset/problem/1132/F 题目大意: 给你一个串 \(s\),每次可以花费 $1$ 的代价删去一个子串,要求子串的每一位为同一个字符。 求删去整个串的最小代价。 $1\le |s|\le 500$ 解题思路: 区间DP 阅读全文
posted @ 2020-09-30 10:57 quanjun 阅读(186) 评论(0) 推荐(0)
摘要: 题目链接:https://codeforces.com/problemset/problem/478/D 解题思路: 定义 \(f[i][j]\) 表示第 \(i\) 层并且总使用了 \(j\) 个红色格子的方案总数。 则:\(f[i][j] = f[i-1][j] + f[i-1][j-h]\)( 阅读全文
posted @ 2020-09-29 21:43 quanjun 阅读(158) 评论(0) 推荐(0)
摘要: 题目链接:https://codeforces.com/problemset/problem/1370/D 解题思路: 一开始的想法是定义状态 \(dp_{i,j}\) 表示“前 \(i\) 个数,选了第 \(i\) 个数,共选了 \(j\) 个数的最小值”。则状态转移方程为(没有验证过): \(d 阅读全文
posted @ 2020-09-29 18:57 quanjun 阅读(168) 评论(0) 推荐(0)
摘要: 目前还没有做。等开始做了在此更新。。 阅读全文
posted @ 2020-09-29 17:08 quanjun 阅读(406) 评论(0) 推荐(0)
摘要: 题目链接:https://www.luogu.com.cn/problem/P2534 解题思路: IDA*搜索。 首先需要离散化一下,\(\Rightarrow\) \(n\) 个数变为了 $0 \sim n-1$。 然后估价函数 \(h()\) 可以定义为相邻元素相差不为 $1$ 的对数,当然如 阅读全文
posted @ 2020-09-28 21:58 quanjun 阅读(186) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2234 题目大意: 一天机器人小A在玩一个简单的智力游戏,这个游戏是这样的,在一个4*4的矩阵中分别有4个1,4个2,4个3和4个4分别表示4种不同的东西,每一步小A可以把同一行的4个数往左移或者往右移一 阅读全文
posted @ 2020-09-28 20:48 quanjun 阅读(134) 评论(0) 推荐(0)
摘要: 题目链接:https://codeforces.com/contest/1420/problem/E 题目大意: 给你一个长度为 \(n\) 的 $01$序列,每一次操作你可以交换相邻的两个元素。 定义序列的 保护值( protection )为“序列中一对数值为 $0$ 的数,且这对数之间夹着至少 阅读全文
posted @ 2020-09-25 17:20 quanjun 阅读(315) 评论(0) 推荐(0)
摘要: 示例代码: #include <bits/stdc++.h> using namespace std; int a[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int main() { partial_sum(a, a+11, a); // a已经变为了原来的 阅读全文
posted @ 2020-09-25 17:07 quanjun 阅读(718) 评论(0) 推荐(1)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6171 题目大意: 假设你是一个著名的海军上将。我们海军有 \(21\) 艘战舰。战舰有 \(6\) 种类型。 首先,我们有一艘 指挥舰 ,海军上将必须在其中,它用数字 \(0\) 表示。其他的战舰的类型 阅读全文
posted @ 2020-09-19 15:34 quanjun 阅读(157) 评论(0) 推荐(0)
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3017 题目大意: 有 \(n(\le 30)\) 块硬币(\(n\) 可能是奇数),每块硬币都有一个币值。要求将 \(n\) 块金币分成两堆,使得两堆硬币币值和的差尽可能地小。输出这个最小的差。 解题思 阅读全文
posted @ 2020-09-18 23:27 quanjun 阅读(143) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 58 下一页