![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
Weaver丶
这个作者很懒,什么都没留下…
展开
-
牛客多校第三场 E-Two Matchings
题目大意有一个长度为n的数组a,然后让我们求两个序列p,q,满足p和q是由序列1-n两两交换得到的,并且对于每一个i满足pi!=qi。然后使得值最小,求这个值。解题思路题目可以翻译成:对于数组a,两两组队,使得式子的值最小。也就是我们要找一个序列,使得这个式子最小,和一个序列使得这个式子次小。对于最小的值,我们可以对数组a排序之后每两个组成一队,可以知道这个值是最小的,证明方法,就是在数轴上表示出来,可以证明其他画法都会在包含该方法的线段之外还会包含其他额外的线段。对于次小值,我们可以将n分成4原创 2020-07-18 23:23:37 · 130 阅读 · 0 评论 -
Gym - 102439H(数位DP)
Fibonacci numbers — well-known integer sequence, where F0=0, F1=1 and Fn=Fn−1+Fn−2 for n>1.Lesha doesn’t like this sequence and all the numbers x, such that we can get positive Fibonacci number by...原创 2020-01-12 20:55:10 · 302 阅读 · 1 评论 -
Codefroces-510D
Fox Ciel is playing a game. In this game there is an infinite long tape with cells indexed by integers (positive, negative and zero). At the beginning she is standing at the cell 0.There are also n c...原创 2020-01-12 16:04:10 · 1470 阅读 · 0 评论 -
HDU-1074(状压DP)
Problem DescriptionIgnatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in t...原创 2020-01-11 21:03:56 · 228 阅读 · 0 评论 -
HDU-5945(DP+单调队列优化)
Problem DescriptionYoung theoretical computer scientist Fxx designed a game for his students.In each game, you will get three integers X,k,t.In each step, you can only do one of the following moves:...原创 2020-01-11 20:46:59 · 256 阅读 · 0 评论 -
HDU-2196(树形DP)
Problem DescriptionA school bought the first computer some time ago(so this computer’s id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of...原创 2020-01-08 20:59:45 · 146 阅读 · 0 评论 -
HDU-4607(树形DP)
Problem DescriptionClaire 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) undir...原创 2020-01-08 20:10:41 · 129 阅读 · 0 评论 -
luogu-P2899
题目描述Farmer John has decided to give each of his cows a cell phone in hopes to encourage their social interaction. This, however, requires him to set up cell phone towers on his N (1 ≤ N ≤ 10,000) pas...原创 2020-01-07 14:47:51 · 114 阅读 · 1 评论 -
luogu-p1880
题目描述在一个圆形操场的四周摆放 NN 堆石子,现要将石子有次序地合并成一堆.规定每次只能选相邻的2堆合并成新的一堆,并将新的一堆的石子数,记为该次合并的得分。试设计出一个算法,计算出将 NN 堆石子合并成 11 堆的最小得分和最大得分。输入格式数据的第 11 行是正整数 NN,表示有N堆石子。第 2 行有 N 个整数,第 i 个整数 ai 表示第 i 堆石子的个数。输出格式输出共...原创 2020-01-06 18:10:39 · 107 阅读 · 0 评论 -
luogu-p1603
题目描述在MarsMars星球上,每个MarsMars人都随身佩带着一串能量项链。在项链上有NN颗能量珠。能量珠是一颗有头标记与尾标记的珠子,这些标记对应着某个正整数。并且,对于相邻的两颗珠子,前一颗珠子的尾标记一定等于后一颗珠子的头标记。因为只有这样,通过吸盘(吸盘是MarsMars人吸收能量的一种器官)的作用,这两颗珠子才能聚合成一颗珠子,同时释放出可以被吸盘吸收的能量。如果前一颗能量珠的头...原创 2020-01-06 17:58:05 · 109 阅读 · 0 评论 -
洛谷-P5020
题目链接:https://www.luogu.org/problem/P5020题目大意为:在给出的一个有n种面值,面值的集合为a的货币系统中,我们可以称之为(n,a)货币系统,而我们定义两种货币系统是相等的,必须两个货币系统能够表示的货币情况都是相同的。解题思路:我们先把货币面值先按照从小到大排序,如果大的面值能够由一些比它小的面值的货币组合起来,那么我们就可以删掉这种面值的货币(卑微的博主...原创 2019-11-21 15:43:44 · 190 阅读 · 0 评论