
简单dp
文章平均质量分 65
Fox...
…
展开
-
Power OJ 2925: 完美数字3.0
...传送门显然,数位dp+kmp,对于当前位失配后,跳失配指针(Next数组)显然,数位dp+kmp,对于当前位失配后,跳失配指针(Next数组)显然,数位dp+kmp,对于当前位失配后,跳失配指针(Next数组)注意判前导零注意判前导零注意判前导零code:code:code:#include <set>#include <map>#include <list>#include <cmath>#include <stack>原创 2021-03-17 16:59:16 · 138 阅读 · 0 评论 -
数位dp
P2602 [ZJOI2010]数字计数题意:给定两个正整数a和b,求在[a,b][a,b]中的所有整数中题意:给定两个正整数 a 和 b,求在 [a,b][a,b] 中的所有整数中题意:给定两个正整数a和b,求在[a,b][a,b]中的所有整数中每个数码(digit)各出现了多少次。每个数码(digit)各出现了多少次。每个数码(digit)各出现了多少次。分析:对于0−9出现的次数依次枚举即可分析:对于0-9出现的次数依次枚举即可分析:对于0−9出现的次数依次枚举即可#include <s原创 2021-02-10 11:37:03 · 92 阅读 · 0 评论 -
HDU 1069 Monkey and Banana
传送门题意:题意:输入一个n,表示有n个长方体,每个长方体无限多。问最高可以堆多高,条件是长和宽都比下面的小;分析:对于给定的一组长宽高,有三种堆积方式,我们只需要保存每一种情况,然后对长和宽排序,在利用线性dp就可以求出;#include <iostream>#include <stdio.h>#include <string>#include<cstring>#include <cstring>#include <algo原创 2020-08-20 10:02:41 · 109 阅读 · 0 评论 -
简单动态规划-Q
Whuacmers use coins.They have coins of value A1,A2,A3…An Silverland dollar. One day Hibix opened purse and found there were some coins. He decided to buy a very nice watch in a nearby shop. He wanted to pay the exact price(without change) and he known the原创 2020-07-11 19:24:56 · 123 阅读 · 0 评论 -
简单动态规划篇-M(完全背包恰好装满求最小值)
Before ACM can do anything, a budget must be prepared and the necessary financial support obtained. The main income for this action comes from Irreversibly Bound Money (IBM). The idea behind is simple. Whenever some ACM member has any small money, he takes原创 2020-07-10 20:35:05 · 2720 阅读 · 0 评论 -
暑假集训-简单动态规划篇-G
Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估计了他得到这个学校offer的可能性b。不同学校之间是否得到offer不会互相影响。“I NEED A OFFER”,他大叫一声。帮帮这个可怜的人吧,帮助他计算一原创 2020-07-08 22:13:13 · 110 阅读 · 0 评论 -
暑假集训-简单动态规划篇-C
Given a sequence a[1],a[2],a[3]…a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first line of the input contains an integer T(1<=T<=20) w原创 2020-07-08 17:14:47 · 141 阅读 · 0 评论