dp集训
文章平均质量分 62
我不是手机
这个作者很懒,什么都没留下…
展开
-
acwing 1432. 棋盘挑战 DFS爆搜
给定一个 N×N 的棋盘,请你在上面放置 N 个棋子,要求满足:每行每列都恰好有一个棋子每条对角线上都最多只能有一个棋子1 2 3 4 5 61 | | O | | | | |2 | | | | O | | |3 | | | | | | O |4 | O | | | | | |5 | | | O | | | |6 | | | | | O | |上图给原创 2021-01-22 20:47:48 · 92 阅读 · 0 评论 -
Round Numbers POJ - 3252 01二进制 数位DP 寒假集训
The cows, as you know, have no fingers or thumbs and thus are unable to play Scissors, Paper, Stone’ (also known as ‘Rock, Paper, Scissors’, ‘Ro, Sham, Bo’, and a host of other names) in order to make arbitrary decisions such as who gets to be milked first原创 2021-01-22 20:43:58 · 114 阅读 · 0 评论 -
P1886 滑动窗口 /【模板】单调队列 寒假集训
有一个长为 nn 的序列 aa,以及一个大小为 kk 的窗口。现在这个从左边开始向右滑动,每次滑动一个单位,求出每次滑动后窗口中的最大值和最小值。例如:The array is [1,3,-1,-3,5,3,6,7][1,3,−1,−3,5,3,6,7], and k = 3k=3。输入格式输入一共有两行,第一行有两个正整数 n,kn,k。 第二行 nn 个整数,表示序列 aa输出格式输出共两行,第一行为每次窗口滑动的最小值第二行为每次窗口滑动的最大值输入输出样例输入 #1复制8 3原创 2021-01-22 20:37:13 · 80 阅读 · 0 评论 -
Subsequence HDU - 3530 维护区间最大差值 单调队列 寒假集训
There is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum element of the subsequence is no smaller than m and no larger than k.InputThe原创 2021-01-22 20:35:01 · 237 阅读 · 1 评论 -
Balanced Number HDU - 3709 寻找力矩 数位DP 寒假集训
A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit. When a pivot is placed at some digit of the number, the distance from a原创 2021-01-22 20:29:15 · 88 阅读 · 0 评论 -
Bomb HDU - 3555 出现多少个49,数位DP, 寒假集训
反恐精英在尘土中发现了一枚定时炸弹。但这次恐怖分子改进了定时炸弹。定时炸弹的编号顺序从1到N计数。如果当前的编号顺序包括(子串!!)“49”,爆炸威力将增加一个点。问最后爆炸的时候威力为多少。输入描述输入T代表T组(T <= 1e4)每组输入一个n(1 <= n<=2^63 - 1)输出描述输出爆炸的威力样例输入11样例输出0区间里面的数字间出现了多少个49,数位dp板子#include <stdio.h>#include <string.h&原创 2021-01-22 20:25:28 · 153 阅读 · 1 评论 -
Dire Wolf HDU - 5115 区间DP,寒假集训
有n头狼排成一排,每只狼两个属性,攻击力和加成值,狼的实际攻击力等于自身攻击力加相邻狼的加成值,被杀死之后的狼对相邻的狼的攻击力的加成会被取消,同时,原先与 被杀死的狼相邻的两头狼会变成相邻的狼。问杀死所有狼受到的伤害值最小是。Input多组输入,第一行一个T每组输入一个n(n <= 200)输入n个数,代表每只狼的攻击力(0<=a[i] <=1e5)输入n个数,代表每只狼的加成值(0<=b[i]<=5e4)Output每组样例输出一个Case,然后输出答案。S原创 2021-01-22 20:22:55 · 95 阅读 · 0 评论 -
Maximum Sequence HDU 6047 单调队列 思维题 寒假集训
Steph is extremely obsessed with “sequence problems” that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what is the next number? Steph always finds them too easy for such a genius like himself until one day Klay comes up with a problem原创 2021-01-22 19:59:36 · 88 阅读 · 0 评论 -
Common Subsequene POJ 1458 LCS最长公共子序列问题,寒假集训
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, …, xm > another sequence Z = < z1, z2, …, zk > is a subsequence of X if there exists a strictly increasing seque原创 2021-01-22 19:19:15 · 83 阅读 · 0 评论 -
数字游戏 区间内取模 数位DP 寒假集训
由于科协里最近真的很流行数字游戏,某人又命名了一种取模数,这种数字必须满足各位数字之和 modN 为 0。现在大家又要玩游戏了,指定一个整数闭区间 [a,b],问这个区间内有多少个取模数。输入格式题目有多组测试数据。每组只含三个数字 a,b,N。输出格式对于每个测试数据输出一行,表示各位数字和 modN 为 0 的数的个数。样例Input Output1 19 92数据范围与提示对于全部数据,1≤a,b≤231−1,1≤N<100。取模即使在当前位置上改变余数状态,板子记下来吧原创 2021-01-20 20:15:34 · 247 阅读 · 4 评论 -
数字游戏1 区间内的不降数,数位DP 寒假集训
科协里最近很流行数字游戏。某人命名了一种不降数,这种数字必须满足从左到右各位数字成小于等于的关系,如 123,446。现在大家决定玩一个游戏,指定一个整数闭区间 [a,b],问这个区间内有多少个不降数。输入格式有多组测试数据。每组只含两个数字 a,b,意义如题目描述。输出格式每行给出一个测试数据的答案,即 [a,b] 之间有多少不降数。样例Input Output1 91 19918数据范围与提示对于全部数据,1≤a≤b≤231−1。简单题,只要记得使位数上的数字进行排序#inc原创 2021-01-20 20:12:33 · 295 阅读 · 0 评论 -
B-number HDU - 3652 数字取模 数位DP 寒假集训
统计区间 [1,n] 中含有 ‘13’ 且模 13 为 0 的数字有多少个。输入格式多组数据每行一个正整数n(1 ≤ n ≤ 1e9)一直输入到文件结束输出格式输出一行表示满足条件的答案样例输入131002001000样例输出1122多了一维来记录这个当前位置上的数字mod的余数,当板子写把。#include <stdio.h>#include <string.h>#include <math.h>#include <map原创 2021-01-20 20:09:37 · 158 阅读 · 1 评论 -
不要62 HDU - 2089 数位dp 除62以外的数字个数 寒假集训
杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)。杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可以消除个别的士司机和乘客的心理障碍,更安全地服务大众。不吉利的数字为所有含有4或62的号码。例如:62315 73418 88914都属于不吉利号码。但是,61152虽然含有6和2,但不是62连号,所以不属于不吉利数字之列。你的任务是,对于每次给出的一个牌照区间号,推断出交管局今次又要实际上给多少辆新的士车上牌照了。Input输入的原创 2021-01-20 20:06:19 · 72 阅读 · 0 评论 -
Aeroplane chess HDU - 4405 飞行棋问题 期望DP 寒假集训
Hzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws a dice(a dice have six faces with equal probability to face up and the numbers on the faces are 1,2,3,4,5,6). When Hzz原创 2021-01-19 20:52:36 · 162 阅读 · 0 评论 -
Park Visit HDU - 4607 树的直径 链试前向星 寒假集训
Claire and her little friend, ykwd, are travelling in Shevchenko’s Park! The park is beautiful - but large, indeed. N feature spots in the park are connected by exactly (N-1) undirected paths, and Claire is too tired to visit all of them. After considerati原创 2021-01-19 13:11:38 · 92 阅读 · 0 评论 -
Bag of mice CodeForces - 148D 公主与龙 概率DP 寒假集训
The dragon and the princess are arguing about what to do on the New Year’s Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they should just go to bed early. They are desperate to come to原创 2021-01-19 13:04:40 · 162 阅读 · 0 评论 -
Anniversary party HDU-1520员工聚会 树形DP(链试前向星法) 寒假集训
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tree rooted at the rector V. E. Tretyakov. In order to mak原创 2021-01-18 18:07:39 · 176 阅读 · 0 评论 -
Godfather POJ-3107 树的重心 链试前向星 寒假集训
Last years Chicago was full of gangster fights and strange murders. The chief of the police got really tired of all these crimes, and decided to arrest the mafia leaders.Unfortunately, the structure of Chicago mafia is rather complicated. There are n pers原创 2021-01-18 17:59:18 · 83 阅读 · 0 评论 -
Mondriaan‘s Dream poj-2411 铺瓷砖 状压dp 寒假集训
Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his ‘toilet series’ (where he had to use his toilet paper to draw on, for all of his paper was filled with squares and rectangles), he dre原创 2021-01-17 19:49:13 · 116 阅读 · 0 评论 -
Palindrome subsequence HDU-4632区间dp 回文问题 寒假集训
In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. For example, the sequence <A, B, D> is a subsequence of <A, B, C, D, E, F>.(h原创 2021-01-17 13:49:41 · 88 阅读 · 0 评论 -
Brackets POJ -2955 括号匹配 区间dp 寒假集训
We give the following inductive definition of a “regular brackets” sequence:the empty sequence is a regular brackets sequence,if s is a regular brackets sequence, then (s) and [s] are regular brackets sequences, andif a and b are regular brackets sequen原创 2021-01-17 13:42:19 · 106 阅读 · 0 评论