随笔分类 -  04.动态规划

摘要:题目链接:http://codeforces.com/problemset/problem/180/C 题意: 有一段字符串,包含大小写字母,每次可以将其中一个字母由大写变成小写,或者小写变成大写。要求这个字符串最终变成任意大写字母都在任意小写字母的前面的情况。问最少变换多少个字母可达到要求。 题解 阅读全文
posted @ 2019-03-02 10:20 Dilthey 阅读(281) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/698/A 题意: 有 $n$ 天假期,每天有四种情况:0、体育馆不开门,没有比赛;1、体育馆不开门,有比赛;2、体育馆开门,没有比赛;3、体育馆开门,有比赛。 每天都可以选择一件事做:休息、去体育馆运动、打 阅读全文
posted @ 2019-03-02 09:44 Dilthey 阅读(264) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/1108/D time limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standar 阅读全文
posted @ 2019-02-28 23:59 Dilthey 阅读(519) 评论(0) 推荐(0)
摘要:题目链接:https://zhixincode.com/contest/18/problem/G?problem_id=265 题目描述 wls有一个整数 $n$,他想请你算一下有多少 $1...n$ 的排列(permutation)满足:对于所有的 $i(2 \le i \le n)$,若 $i$ 阅读全文
posted @ 2019-02-20 16:19 Dilthey 阅读(142) 评论(0) 推荐(0)
摘要:题目链接:https://codeforces.com/gym/102056/problem/I Warm sunshine, cool wind and a fine day, while the girl watching is pursuing in chaos. Rikka reached 阅读全文
posted @ 2019-01-06 21:30 Dilthey 阅读(1153) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5542 Problem DescriptionCao Cao made up a big army and was going to invade the whole South China. Yu Zh 阅读全文
posted @ 2018-11-02 21:44 Dilthey 阅读(396) 评论(1) 推荐(0)
摘要:题目链接:http://codeforces.com/gym/101873/problem/I 题意: 给出 $n(1 \le n \le 300000)$ 个单位时间,每个单位时间给出一个 $x_i(0 \le x_i \le 32)$ 代表该单位时间内视野内的敌人数目。 现在你有一个终极武器,每 阅读全文
posted @ 2018-11-02 14:02 Dilthey 阅读(379) 评论(0) 推荐(0)
摘要:题目链接:https://www.lydsy.com/JudgeOnline/problem.php?id=1003 Time Limit: 10 Sec Memory Limit: 162 MB Description 物流公司要把一批货物从码头A运到码头B。由于货物量比较大,需要n天才能运完。货 阅读全文
posted @ 2018-10-25 00:00 Dilthey 阅读(326) 评论(0) 推荐(0)
摘要:题目链接:https://nanti.jisuanke.com/t/31434 小 D 是一位著名的车手,他热衷于在广场上飙车。每年儿童节过后,小 D 都会在广场上举行一场别样的车技大赛。 小 D 所在的广场可以看作一个 W×H 的网格,初始时小 D 位于左下角的 (1,1) 处,他的目的地是位于右 阅读全文
posted @ 2018-10-08 22:53 Dilthey 阅读(537) 评论(0) 推荐(1)
摘要:题目链接:http://poj.org/problem?id=1426 Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation con 阅读全文
posted @ 2018-09-23 20:47 Dilthey 阅读(637) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6447 Problem DescriptionYJJ is a salesman who has traveled through western country. YJJ is always on jo 阅读全文
posted @ 2018-08-26 23:57 Dilthey 阅读(657) 评论(0) 推荐(0)
摘要:题目链接:https://www.nowcoder.com/acm/contest/141/A 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K Special Judge, 64bit IO Format: %lld 题目描述 Eddy was 阅读全文
posted @ 2018-07-26 15:14 Dilthey 阅读(372) 评论(0) 推荐(0)
摘要:题目链接:https://www.nowcoder.com/acm/contest/140/A 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/ 阅读全文
posted @ 2018-07-23 10:41 Dilthey 阅读(229) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1417 Time Limit: 1000MS Memory Limit: 10000K Description After having drifted about in a small boat for a couple of day 阅读全文
posted @ 2018-04-25 20:51 Dilthey 阅读(406) 评论(0) 推荐(0)
摘要:题目链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1183 编辑距离,又称Levenshtein距离(也叫做Edit Distance),是指两个字串之间,由一个转成另一个所需的最少编辑操作次数。许可的编辑操作包括 阅读全文
posted @ 2018-03-24 11:39 Dilthey 阅读(307) 评论(0) 推荐(0)
摘要:这道题目可以说是一道非常好非常一颗赛艇的DP题了。 需要注意的是,其中情形3),字符串必然能完全转化为 N(str)形式,如果有N(str1)M(str2)等等另外样式,应该首先使用拼接形式对其进行划分。 那么,我们首先考虑写一个用来压缩情形3)下的字符串的函数zip(): 1 char str[1 阅读全文
posted @ 2017-07-28 19:30 Dilthey 阅读(578) 评论(0) 推荐(0)
摘要:据说是经典dp问题? 对于每个a[i][j],表示第 i 种花放在第 j 个花瓶里时产生的美学价值(aesthetic value), 我们用dp[i][j]表示共 i 种花放到 j 个花瓶里,产生的最大美学价值(显然这需要i<=j)。 那么我们的答案也很简单,就是dp[F][V]。 那么接下来就是 阅读全文
posted @ 2017-07-26 22:02 Dilthey 阅读(130) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=1050 Description Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub 阅读全文
posted @ 2017-07-26 20:59 Dilthey 阅读(460) 评论(0) 推荐(0)
摘要:给定一段文字,已知单词a1, a2, …, an出现的频率分别t1, t2, …, tn。可以用01串给这些单词编码,即将每个单词与一个01串对应,使得任何一个单词的编码(对应的01串)不是另一个单词编码的前缀,这种编码称为前缀码。 使用前缀码编码一段文字是指将这段文字中的每个单词依次对应到其编码。 阅读全文
posted @ 2017-05-22 13:56 Dilthey 阅读(1027) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3368 RMQ应用题。 解题思路参考:http://blog.csdn.net/libin56842/article/details/46482803 附一个网上的数据生成器: 阅读全文
posted @ 2017-05-03 13:13 Dilthey 阅读(167) 评论(0) 推荐(0)