dp
文章平均质量分 87
To_be_strong
一步一个脚印
展开
-
南阳ccpc D题 Pick The Sticks
Pick The SticksTime Limit: 15000/10000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)Submit StatusThe story happened long long ago. One day, Cao Cao made a special原创 2015-10-27 20:35:34 · 745 阅读 · 0 评论 -
HDU 2476 String painter(区间dp)
Problem 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 ch原创 2016-02-20 14:50:28 · 538 阅读 · 0 评论 -
poj 3280 Cheapest Palindrome(区间dp)
题目链接:http://poj.org/problem?id=3280;题意:给你一个字符串,然后给你一个字符表,里面有删除和添加这个字符的代价,问你把他最后变成回文串的最小代价。思路:我们可以dp[i][j]表示从第i个字符到第j个字符变成回文串的最小代价,然后对应dp[i+1][j]和dp[i][j-1]我们可以选择删除和添加对应字符的最小代价,如果s[i] == s[j] 的话,就直原创 2016-02-17 10:24:57 · 516 阅读 · 0 评论 -
UVALive - 3942 Remember the Word(trie + dp)
题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=22109;思路:dp[i]表示原串从i开始的后段子串的方案数,从后往前dp,然后dp[i] = sum(dp[i + len(x)],这里的x是给出单词并且是这后段的前缀串。如果直接枚举的话会超时,先把单词全部加到字典树上面然后在字典树上面查找就可以了。我是用指针原创 2016-02-16 15:36:26 · 656 阅读 · 0 评论 -
lightoj 1011 - Marriage Ceremonies(状态压缩dp)
Time Limit: 2 second(s)Memory Limit: 32 MBYou work in a company which organizes marriages. Marriages are not that easy to be made, so, the job is quite hard for you.The job gets more d原创 2016-04-02 12:21:48 · 546 阅读 · 0 评论 -
lightoj 1033 - Generating Palindromes(区间dp)
1033 - Generating Palindromes PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBBy definition palindrome is a string which is not原创 2016-04-07 22:33:24 · 685 阅读 · 0 评论 -
lightoj 1017 - Brush (III)(dp)
1017 - Brush (III) PDF (English)StatisticsForumTime Limit: 2 second(s)Memory Limit: 32 MBSamir returned home from the contest and got angry after seei原创 2016-04-09 10:25:34 · 359 阅读 · 0 评论 -
HDU 5677 ztr loves substring (dp)
Problem Descriptionztr love reserach substring.Today ,he has n string.Now ztr want to konw,can he take out exactly k palindrome from all substring of these n string,and thrn sum of length of these原创 2016-05-01 12:08:07 · 909 阅读 · 4 评论 -
lightoj 1283 1283 - Shelving Books(dp)
#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;int INF = 0x3f3f3f3f;const int N = 1e2 + 10;int dp[N][N][N], a[N], b[N], c原创 2016-05-20 23:16:29 · 602 阅读 · 0 评论 -
HDU 5616 Jam's balance(dp)
Jam's balanceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 356 Accepted Submission(s): 163Problem DescriptionJim has a bala原创 2016-01-31 20:45:27 · 889 阅读 · 2 评论 -
HDU 3001 Travelling(状态压缩dp)
TravellingTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5765 Accepted Submission(s): 1858Problem DescriptionAfter coding so原创 2016-01-29 19:36:17 · 702 阅读 · 0 评论 -
HDU 3091 Necklace (状态压缩dp)
#include#include#include#include#include#include#include#include#includeusing namespace std;const int N = (1<<18) + 10;const double eps = 1e-10;typedef long long ll;ll dp[N][20];int Map[原创 2016-01-28 18:50:29 · 540 阅读 · 0 评论 -
HDU 5375 Gray code
Gray codeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 983 Accepted Submission(s): 548Problem DescriptionThe reflected bina原创 2015-11-07 21:21:03 · 330 阅读 · 0 评论 -
HDU 5532 Almost Sorted Array
Almost Sorted ArrayTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 570 Accepted Submission(s): 234Problem DescriptionWe are原创 2015-11-06 21:30:39 · 420 阅读 · 0 评论 -
南阳ccpc C题 The Battle of Chibi(树状数组优化+dp)
The Battle of ChibiTime Limit: 6000/4000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)Submit StatusCao Cao made up a big army and was going to invade the whole So原创 2015-10-29 22:14:09 · 1606 阅读 · 0 评论 -
hdu 5569 matrix(dp)
matrixTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 329 Accepted Submission(s): 199Problem DescriptionGiven a matrix with n原创 2015-11-23 16:59:12 · 278 阅读 · 0 评论 -
hdu5568 sequence2(dp + 高精度)
sequence2Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 385 Accepted Submission(s): 151Problem DescriptionGiven an integer a原创 2015-11-23 16:52:03 · 290 阅读 · 0 评论 -
51Nod 算法马拉松7 B选数字
选数字System Message (命题人)基准时间限制:1 秒 空间限制:131072 KB 分值: 80当给定一个序列a[0],a[1],a[2],...,a[n-1] 和一个整数K时,我们想找出,有多少子序列满足这么一个条件:把当前子序列里面的所有元素乘起来恰好等于K。样例解释:对于第一个数据,我们可以选择[3]或者[原创 2015-11-01 22:20:12 · 435 阅读 · 0 评论 -
fzuoj 2218 Simple String Problem(状态压缩dp)
Problem 2218 Simple String ProblemAccept: 10 Submit: 40Time Limit: 2000 mSec Memory Limit : 32768 KB Problem DescriptionRecently, you have found your interest in string theory. H原创 2015-12-29 21:14:09 · 1024 阅读 · 0 评论 -
POJ 1661Help Jimmy(dp)
Help JimmyTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 9708 Accepted: 3147Description"Help Jimmy" 是在下图所示的场景上完成的游戏。 场景中包括多个长度和高度各不相同的平台。地面是最低的平台原创 2015-12-04 22:48:05 · 314 阅读 · 0 评论 -
lightoj 1122 - Digit Count(dp)
Time Limit: 2 second(s)Memory Limit: 32 MBGiven a set of digits S, and an integer n, you have to find how many n-digit integers are there, which contain digits that belong to S and the d原创 2016-04-07 22:41:09 · 736 阅读 · 0 评论