![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
文章平均质量分 81
CatDsy
一只慵懒的喵
展开
-
Codeforces 797E Array Queries
题目 describe a is an array of n positive integers, all of which are not greater than n. You have to process q queries to this array. Each query is represented by two numbers p and k. Several ope原创 2017-05-25 23:15:45 · 346 阅读 · 0 评论 -
Multiplication Puzzle (区间dp)
Multiplication Puzzle(区间dp)DescriptionThe multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and...原创 2018-08-07 16:27:40 · 411 阅读 · 0 评论 -
Brackets(区间dp)
DescriptionWe 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...原创 2018-08-07 16:59:33 · 280 阅读 · 0 评论 -
String painter(区间dp)
DescriptionThere are two strings A and B with equal length. Both strings are made up of lower case letters. Now you have a powerful string painter. With the help of the painter, you can change a seg...原创 2018-08-07 20:05:25 · 236 阅读 · 0 评论 -
You Are the One(区间dp)
DescriptionThe 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 at...原创 2018-08-08 10:04:24 · 295 阅读 · 0 评论 -
Shoot Game(区间dp)
题目链接:[http://acm.hdu.edu.cn/showproblem.php?pid=6365]DescriptionYou are playing a shooting game. The rules of the game are like this: You are in a two-dimensional plane and stand at (0,0). There...原创 2018-08-13 21:24:37 · 296 阅读 · 0 评论 -
Rikka with Seam (DP+前缀和优化)
题目链接:[http://acm.hdu.edu.cn/showproblem.php?pid=6416]题目描述:给定一个N∗MN∗MN*M的01矩阵K-seam是满足以下条件的整数序列a:|a|=n,ai∈[1,m]|a|=n,ai∈[1,m] |a| = n , a_i \in [1,m]|ai−ai+1|≤K,i∈[1,n)|ai−ai+1|≤K,i∈[1,n) |...原创 2018-08-20 19:20:13 · 1133 阅读 · 0 评论 -
Round Subset(codeforces 837D)
题目链接:[http://codeforces.com/problemset/problem/837/D]分析:末尾为零,显然是由2*5得到的。 对每一个aiaia_i进行分解,得到2和5的数量。大概计算一下,2的数量最多有12800个,5的数量最多有6000个,所以用5的数量作为背包容量,计算最多可以有多少个2。 转移方程为dp[i][k][j]=max{dp[i−1][k−1][j...原创 2018-08-23 15:51:45 · 367 阅读 · 0 评论 -
2018 ICPC 徐州网络赛
A. Hard to prepare (dp)题意NNN个客人,主人手上有2k2k2^k个面具。 现在,NNN个人围着圆桌相邻而坐,主人会给他们每个人发一个面具,相邻两个人得到的面具i,ji,ji,j必须满足条件:iii XNORXNORXNOR jjj为正数。 问:有多少种方案?最终答案对 109+7109+710^9 + 7 取膜分析mask[i] XNOR mask[1...原创 2018-09-09 17:34:16 · 1080 阅读 · 0 评论 -
Halloween Costumes(区间DP)
Halloween Costumes 区间DPDescriptionGappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it’s Halloween, t...原创 2018-08-07 16:11:06 · 284 阅读 · 1 评论 -
Food Delivery (区间dp)
DescriptionWhen we are focusing on solving problems, we usually prefer to stay in front of computers rather than go out for lunch. At this time, we may call for food delivery.Suppose there are N p...原创 2018-08-11 15:24:07 · 1245 阅读 · 0 评论 -
Codeforces 797B Odd sum
You are given sequence a1, a2, …, an of integer numbers of length n. Your task is to find such subsequence that its sum is odd and maximum among all such subsequences. It’s guaranteed that given sequen原创 2017-05-23 10:48:23 · 453 阅读 · 0 评论 -
BestCoder Round #84 Bellovin
Peter has a sequence a1,a2,…,ana1,a2,…,an and he define a function on the sequence – F(a1,a2,…,an)=(f1,f2,…,fn), where fi is the length of the longest increasing subsequence ending with ai. Peter w原创 2017-05-19 23:33:33 · 251 阅读 · 0 评论 -
Array GCD
题目 You are given array ai of length n. You may consecutively apply two operations to this array:remove some subsegment (continuous subsequence) of length m < n and pay for it m·a coinschange some el原创 2017-08-18 19:55:48 · 463 阅读 · 0 评论 -
Good Sequences(codeforces 264B)
题目: Squirrel Liss is interested in sequences. She also has preferences of integers. She thinks n integers a1, a2, …, an are good.Now she is interested in good sequences. A sequence x1, x2, …, xk is ca原创 2017-08-21 10:46:17 · 655 阅读 · 0 评论 -
Codeforces 621E(dp+矩阵快速幂)
Wet Shark and Blocks题意 有 bbb 组数,每组都有相同的 nnn 个数,现要从每组数中选择一个数,联起来构成一个大数,使其对 xxx 取膜后的值为 kkk ,问有多少种方案?最终答案对 109+7109+710^9 + 7 取膜题解dp[j]dp[j] dp[j] : 对 xxx 取膜后的值为 jjj 的方案数 num[a]num[a]num[a] : 数字...原创 2018-07-24 19:13:31 · 270 阅读 · 0 评论 -
Codeforces 1005D(dp)
CF 1005D(dp)题意 给出一个长度不超过 2e52e52e5 的字符串 sss,将其分割成若干连续子段,不可有前导0,使得其构成的数中,为3的倍数的数量最多题解 dp[i]dp[i]dp[i] 记录至第 iii 位可以构成的3的倍数的数量 若 s[i]=0s[i]=0s[i]=0 , dp[i]=dp[i−1]+1dp[i]=dp[i−1]+1dp[i] = dp[i-1]+...原创 2018-07-22 23:41:22 · 273 阅读 · 0 评论 -
Coloring Brackets (区间dp)
DescriptionOnce Petya read a problem about a bracket sequence. He gave it much thought but didn’t find a solution. Today you will face it.You are given string s. It represents a correct bracket se...原创 2018-08-09 23:53:22 · 607 阅读 · 0 评论 -
Cake(凸包+区间dp)
DescriptionYou want to hold a party. Here’s a polygon-shaped cake on the table. You’d like to cut the cake into several triangle-shaped parts for the invited comers. You have a knife to cut. The tra...原创 2018-08-11 14:35:02 · 369 阅读 · 0 评论 -
Print Article(HDU 3507 -- 斜率dp)
题目来源:http://acm.hdu.edu.cn/showproblem.php?pid=3507题意将nnn个数拆分成若干段,每段的打印代价为m+∑ki=1c[i]m+∑i=1kc[i]m+ \sum_{i=1}^k c[i],求最小代价分析dp[i]dp[i]dp[i] : 打印前 iii 页的最小代价 可以得到一个时间复杂度为O(n∗n)O(n∗n)O(n*n)...原创 2018-09-06 22:15:35 · 270 阅读 · 0 评论