DP
Ha_chuochuo
这个作者很懒,什么都没留下…
展开
-
B-number HDU - 3652 (数位DP)
题目描述:A wqb-number, or B-number for short, is a non-negative integer whose decimal form contains the sub- string "13" and can be divided by 13. For example, 130 and 2613 are wqb-numbers, but 143 and 2639 are not. Your task is to calculate how many wqb-nu原创 2020-07-29 00:41:08 · 128 阅读 · 1 评论 -
Max Sum Plus Plus HDU - 1024 (DP)
题目描述Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem.Given a consecutive number sequence S1, S2, S3, S4... .原创 2020-07-29 00:01:09 · 65 阅读 · 0 评论 -
You Are the One HDU - 4283 (区间DP)
题目描述 The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show itself. The show is hold in the Small hall, so it attract a lot of boys and girls. Now there are n boys enrolling原创 2020-07-28 23:40:32 · 141 阅读 · 0 评论 -
PTA L3-020 至多删三个字符 (DP) (天梯赛训练)
题目描述给定一个全部由小写英文字母组成的字符串,允许你至多删掉其中 3 个字符,结果可能有多少种不同的字符串?输入格式:输入在一行中给出全部由小写英文字母组成的、长度在区间 [4,106] 内的字符串。输出格式:在一行中输出至多删掉其中 3 个字符后不同字符串的个数。思路:用dp[ i ][ j ]表示前 i 个字符中删去 j 个字符时拥有不同字符串的数量。首先不考虑重复的情况,即可以得到转移方程------------------dp[ i ][ j ]=...原创 2020-07-23 19:30:40 · 354 阅读 · 0 评论 -
Codeforces Round #658 (Div. 2)(D. Unmerge)
题目描述Letaaandbbbe two arrays of lengthsnnandmm, respectively, with no elements in common. We can define a new arraymerge(a,b) of lengthn+mn+mrecursively as follows:If one of the arrays is empty, the result is the other array. That is, merge(∅...原创 2020-07-23 12:53:19 · 82 阅读 · 0 评论 -
Codeforces Round #637 (Div. 2)(D、Nastya and Scoreboard DP、DFS)(训练)
D - Nastya and Scoreboard题意:给你n串由0和1组成的长度为7的字符串,n串表示一个n位数,每个串的第n个位置有1则表示这个位置的火柴是亮着的,位置的表示如下图所示,而每个数字可以由指定位置上的火柴组成,给你每个位上已有火柴的位置,再给你k根火柴,问你由这k根火柴和已有火柴组成的数字,最大是多少。解题思路 :用cnt[ i][ j ]表示第i个字符串要表示为数字j所需要的火柴数量。用DFS进行搜索,运用dp记忆化来去掉很多不需要的情况即可。代码:..原创 2020-07-09 21:49:22 · 81 阅读 · 0 评论