随笔分类 -  动态规划

最长对称子串
摘要:样例 123123 6 1211 3 1 232 4 5 数据量不大 1 //暴力 2 #include<bits/stdc++.h> 3 using namespace std; 4 string s,s1,s2; 5 int l1; 6 int main() 7 { 8 //数据量不大,可以2重 阅读全文

posted @ 2020-05-02 11:41 cltt 阅读(190) 评论(0) 推荐(0) 编辑

2019 西安邀请赛 D
摘要:1 //n件物品,m种关系,(有关系的2个不能在同一组) 2 //把所有物品分为2组,希望最后2组的差值尽可能小,输出较大者 3 /* 4 二分图涂色+可行性(01)背包 5 dp[i] =1表示 最后差值为i可行 6 建图后,对于每个连通分量记录差值,来求所有的可行 7 */ 8 #include<bits/stdc++.h> 9 using namespace std; 10 int t,n, 阅读全文

posted @ 2019-10-05 17:14 cltt 阅读(248) 评论(0) 推荐(0) 编辑

字符串 最小编辑
摘要:#include <bits/stdc++.h> using namespace std; #define N 5010 #define ll long long #define inf 0x3f3f3f3f char s[N],p[N]; int ls,lp; int c0,c1,c2; int dp[N][N]; //把s变为p的最小代价 //c0 增加一个的代价 //c1 删除一个的代价 / 阅读全文

posted @ 2019-09-15 15:15 cltt 阅读(215) 评论(0) 推荐(0) 编辑

江西理工大学编程俱乐部 1432
摘要:C: 回文 时间限制: 1 s 内存限制: 128 MB 题目描述 给定一个字符串,你可以对字符串做任意改动,你可以在任意地方增加一个字符、删除一个字符或者改变一个字符。但是不同的操作所花费的代价也是不同的,增加和删除所付出的代价为1,直接改变一个字符所花费的代价为2,问最少花费多少能得到一个回文串 阅读全文

posted @ 2019-09-14 10:57 cltt 阅读(419) 评论(0) 推荐(0) 编辑

最长公共子序列
摘要://poj 1458 Common Subsequence Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 69884 Accepted: 29304 Description A subsequence of a given se 阅读全文

posted @ 2019-09-13 22:12 cltt 阅读(139) 评论(0) 推荐(0) 编辑

概率dp
摘要:一:Uva12230Crossing Rivers (数学期望)题目大意:有个人每天要去公司上班,每次会经过N条河,家和公司的距离为D,默认在陆地的速度为1,给出N条河的信息,包括起始坐标p,宽度L,以及船的速度v。船会往返在河的两岸,人到达河岸时,船的位置是随机的(往返中)。问说人达到公司所需要的 阅读全文

posted @ 2019-04-08 22:31 cltt 阅读(114) 评论(0) 推荐(0) 编辑

数位dp
摘要://hdu 2089 不要62 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 60338 Accepted Submission(s): 238 阅读全文

posted @ 2018-11-18 11:22 cltt 阅读(208) 评论(0) 推荐(0) 编辑

状压dp
摘要://Poj 3254 Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 20258 Accepted: 10633 Description Farmer John has purchased a lush n 阅读全文

posted @ 2018-09-01 21:33 cltt 阅读(273) 评论(0) 推荐(0) 编辑

最大子串和
摘要:Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​, ..., N​j​​ } where 1≤i≤j≤K. T 阅读全文

posted @ 2018-08-30 14:43 cltt 阅读(172) 评论(0) 推荐(0) 编辑

树形 dp
摘要:// ACM训练联盟周赛 C. Teemo's tree problem There is an apple tree in Teemo's yard. It contains n nodes and n-1 branches, and the node 1 is always the root o 阅读全文

posted @ 2018-08-23 16:58 cltt 阅读(158) 评论(0) 推荐(0) 编辑

最长上升子序列
摘要:Almost Sorted Array Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 7686 Accepted Submission(s) 阅读全文

posted @ 2018-08-17 11:57 cltt 阅读(154) 评论(0) 推荐(0) 编辑

poj 3783
摘要:Balls Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1196 Accepted: 783 Description The classic Two Glass Balls brain-teaser is often pose 阅读全文

posted @ 2018-08-16 10:45 cltt 阅读(217) 评论(0) 推荐(0) 编辑

Wannafly挑战赛21 C 大水题
摘要:题目描述 现在给你N个正整数ai,每个数给出一“好数程度” gi(数值相同但位置不同的数之间可能有不同的好数程度)。对于在 i 位置的数,如果有一在j位置的数满足 j < i 且 ai=aj,则你可以将位于[i,j]闭区间内的序列评为“好序列”,然后获得∑gk(j≤k≤i)(此闭区间内“好数程度”之 阅读全文

posted @ 2018-08-11 19:39 cltt 阅读(187) 评论(0) 推荐(0) 编辑

第十四届华中科技大学程序设计竞赛决赛同步赛 Beautiful Land
摘要:It’s universally acknowledged that there’re innumerable trees in the campus of HUST.Now HUST got a big land whose capacity is C to plant trees. We hav 阅读全文

posted @ 2018-08-05 19:12 cltt 阅读(137) 评论(0) 推荐(0) 编辑

B - CD UVA - 624
摘要:https://cn.vjudge.net/contest/224070#problem/B 阅读全文

posted @ 2018-08-05 16:51 cltt 阅读(94) 评论(0) 推荐(0) 编辑

牛客练习赛23 托米的咒语
摘要:托米没有完成上一个任务,准备施展黑魔法推倒 1317 黑魔法咒语被描述为一个 长为 n 的,仅包含小写英文字母 'a'...'i' 的字符串,在托米所在的星球,魔法造成的每次有效伤害都是来自他的一个子序列,对于每一个 'a'... 'i' 的排列(共 9! 种),若作为咒语的子序列出现, 就会造成 阅读全文

posted @ 2018-07-29 00:46 cltt 阅读(254) 评论(0) 推荐(0) 编辑

B Array
摘要:65536K 动态归化+滚动数组 JSZKC is the captain of the lala team. There are NN girls in the lala team. And their height is [1,N][1,N] and distinct. So it means 阅读全文

posted @ 2018-07-24 23:32 cltt 阅读(235) 评论(0) 推荐(0) 编辑

最大字段和
摘要:/ Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 / Joy OI / 题目列表 / 最大子序和 题目限制 时间限制 内存限制 评测方式 题目来源 1000m 阅读全文

posted @ 2018-07-16 15:37 cltt 阅读(151) 评论(0) 推荐(0) 编辑

区间dp
摘要:1 //hdu 1087 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 using namespace std; 11 #define max(a,b) a>b?a:b 12 typedef long long ll; 13 c... 阅读全文

posted @ 2018-07-13 15:15 cltt 阅读(149) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示