![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
基础DP
发型睡姿决定
越努力,越幸运
展开
-
C - Common Subsequence(LCS基础模板题)
添加链接描述 想法: 如果s1[i]==s2[j] 则 c[i][j]=c[i-1][j-1]+1 如果s1[i]!=s2[j] 则 c[i][j]=max(c[i-1][j],c[i][j-1]) #include <iostream> #include <cstring> #include <string> #include <algorithm...原创 2019-07-25 15:15:57 · 146 阅读 · 0 评论 -
C - Bone Collector(01背包DP基础)
Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave … The bone collector ...原创 2019-07-25 16:24:43 · 147 阅读 · 0 评论 -
F - 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活(多重背包)
急!灾区的食物依然短缺! 为了挽救灾区同胞的生命,心系灾区同胞的你准备自己采购一些粮食支援灾区,现在假设你一共有资金n元,而市场有m种大米,每种大米都是袋装产品,其价格不等,并且只能整袋购买。 请问:你用有限的资金最多能采购多少公斤粮食呢? 后记: 人生是一个充满了变数的生命过程,天灾、人祸、病痛是我们生命历程中不可预知的威胁。 月有阴晴圆缺,人有旦夕祸福,未来对于我们而言是一个未知数。那么,我们...原创 2019-07-25 16:33:41 · 78 阅读 · 0 评论 -
B - Big Event in HDU(01背包)
Nowadays, we all know that Computer College is the biggest department in HDU. But, maybe you don’t know that Computer College had ever been split into Computer College and Software College in 2002. Th...原创 2019-07-25 16:39:35 · 106 阅读 · 0 评论 -
E - Robberies(01背包转化)
E - Robberies 添加链接描述 The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to ...原创 2019-07-25 16:46:05 · 86 阅读 · 0 评论 -
F - FatMouse's Speed(LIS最长子序列)
FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you want to take the data on a collection of mice and put as large a subset of this data as possible into a sequence...原创 2019-07-26 10:35:08 · 112 阅读 · 0 评论 -
E - Advanced Fruits(LCS两字符串最短母串模板)
The company “21st Century Fruits” has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times this method doesn’t work, but sometime...原创 2019-07-26 10:55:09 · 165 阅读 · 0 评论 -
B. 掷骰子(概率dp,求逆元)
思路: 求出n个骰子掷出点数之和为a的情况次数,对6^n求逆元再乘和为a的情况数,中间要注意取模,直接上代码,容易理解,最重要的一步就是dp就该情况出现的次数。 #include<set> #include<map> #include<stack> #include<cmath> #include<queue> #include<...原创 2019-08-19 09:37:02 · 174 阅读 · 0 评论 -
True Liars POJ - 1417(并查集+DP)
POJ—1417 题意: 给你p1个好人和p2个坏人,编号为1-p1+p2,然后给你n种操作 x1 x2 no:x1说x2不是好人 x1 x2 yes:x1说x2是好人 在这里好人说的总是对的,坏人说的总是坏的,然后问你最后能不能唯一确定哪些是好人,并输出,否则输出”no“ 思路:首先,我们假设x1是好人,并且有 x1 x2 yes 那么,x2一定也是好人,如果有x1 ...原创 2019-08-13 11:52:07 · 194 阅读 · 0 评论