![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划
文章平均质量分 64
大白菜MC
这个作者很懒,什么都没留下…
展开
-
I NEED A OFFER!(动规,推算一维dp数组,经费为什么不能从前往后遍历)
Problem DescriptionSpeakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了。要申请国外的任何大学,你都要交纳一定的申请费用,这可是很惊人的。Speakless没有多少钱,总共只攒了n万美元。他将在m个学校中选择若干的(当然要在他的经济承受范围内)。每个学校都有不同的申请费用a(万美元),并且Speakless估计了他得到这个学校offer的可能性b。不同学校之间是否得到offer不会互相影响。“I NEED A OFFER”,他大原创 2021-04-01 21:16:54 · 81 阅读 · 0 评论 -
方格取数(1)(状压dp)
Problem Description给你一个nn的格子的棋盘,每个格子里面有一个非负数。从中取出若干个数,使得任意的两个数所在的格子没有公共边,就是说所取的数所在的2个格子不能相邻,并且取出的数的和最大。Input包括多个测试实例,每个测试实例包括一个整数n 和nn个非负数(n<=20)Output对于每个测试实例,输出可能取得的最大的和Sample Input375 15 2175 15 2834 70 5Sample Output188状压dp最后一行的状态取决于前原创 2021-03-29 20:59:38 · 160 阅读 · 0 评论 -
Bone Collector(01背包问题、动态规划)
背包问题动态规划:记录背包从0-v大小情况下,放入每个骨头时的最大价值。#include<stdio.h>#include<string.h>#include<stdlib.h>#define N 1010#define Max(a,b) (a)>(b)?(a):(b)int dp[N][N];int main(){ int t,n,v; scanf("%d",&t); while(t--) {原创 2021-03-14 19:53:05 · 182 阅读 · 0 评论 -
Super Jumping! Jumping! Jumping! (最大递增子序和、动规)
最大递增子序和#include<stdio.h>#include<string.h>#include<stdlib.h>#define Max(a,b) (a)>(b)?(a):(b)int main(){ int n,a[1010],dp[1010]; int max = -1; while(~scanf("%d",&n) && n) { max = -1; f原创 2021-03-14 19:33:10 · 157 阅读 · 0 评论 -
Max Sum(最大字串和、动规)
#include<stdio.h>#include<string.h>#include<stdlib.h>#define N 100010#define Max(a,b) (a)>(b)?(a):(b)int main(){ int T,n,num[N],max,dp[N]; scanf("%d",&T); for(int t = 1; t<=T; t++) { max = -1001;原创 2021-03-14 19:30:21 · 372 阅读 · 0 评论 -
命运(动态规划)
Problem Description穿过幽谷意味着离大魔王lemon已经无限接近了!可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑!可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮帮执着的他吧!命运大迷宫可以看成是一个两维的方格阵列,如下图所示: yifenfei一开始在左上角,目的当然是到达右下角的大魔王所在地。迷宫的每一个格子都受到幸运女神眷恋或者痛苦魔王原创 2021-01-28 18:49:01 · 327 阅读 · 0 评论 -
Longest Ordered Subsequence 最长有序子序列
Longest Ordered SubsequenceProblem DescriptionA numeric sequence of ai is ordered if a1 < a2 < … < aN. Let the subsequence of the given numeric sequence (a1, a2, …, aN) be any sequence (ai1, ai2, …, aiK), where 1 <= i1 < i2 < … < iK原创 2021-01-16 16:57:34 · 672 阅读 · 0 评论 -
Palindrome 回文
PalindromeProblem DescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a string, determines the minimal number of characters to be in原创 2021-01-16 16:28:37 · 413 阅读 · 0 评论