
动态规划
文章平均质量分 82
Puya
人生不设限 没有不可能
展开
-
BZOJ 1863 [Zjoi2006]trouble 皇帝的烦恼【dp+二分】
1863: [Zjoi2006]trouble 皇帝的烦恼Time Limit: 1 Sec Memory Limit: 64 MBSubmit: 557 Solved: 294[Submit][Status][Discuss]Description经过多年的杀戮,秦皇终于统一了中国。为了抵御外来的侵略,他准备在国土边境安置n名将军。不幸的是这n名将军羽翼渐丰,原创 2017-10-05 18:03:56 · 433 阅读 · 0 评论 -
HDU 5492 Find a path【DP】
Find a pathTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1696 Accepted Submission(s): 736Problem DescriptionFrog fell into原创 2017-05-05 19:22:21 · 347 阅读 · 0 评论 -
ZUFE 1120 trs滑雪【记忆化搜索】
1120: trs滑雪时间限制: 1 Sec 内存限制: 128 MB提交: 70 解决: 27[提交][状态][讨论版]题目描述 trs喜欢滑雪。他来到了一个滑雪场,这个滑雪场是一个矩形,为了简便,我们用r行c列的矩阵来表示每块地形。为了得到更快的速度,滑行的路线必须向下倾斜。 例如样例中的那个矩形,可以从某个点滑向上下左右四个相邻的原创 2017-05-13 18:46:38 · 407 阅读 · 0 评论 -
ZUFE 2480 神奇的序列【记忆化搜索】
2480: 神奇的序列时间限制: 4 Sec 内存限制: 256 MB提交: 34 解决: 16[提交][状态][讨论版]题目描述序列a如下:a[0] = A;a[1] = B;a[i] = a[pp] * a[qq]; ( i>=2,pp = 向下取整(i/k1),qq = 向下取整(i/k2) )有Q次询问,每次询问输入pos,请输出a[pos]原创 2017-05-13 16:41:39 · 315 阅读 · 0 评论 -
2016女生赛 1006 Combine String【LCS变形】
Combine StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1735 Accepted Submission(s): 507Problem DescriptionGiven three原创 2017-05-01 19:34:50 · 533 阅读 · 0 评论 -
HDU 1503 Advanced Fruits【LCS】
Advanced FruitsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3371 Accepted Submission(s): 1734Special JudgeProblem Description原创 2017-05-01 17:35:07 · 299 阅读 · 0 评论 -
HDU 1159 Common Subsequence【LCS(dp)】
Common SubsequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 38245 Accepted Submission(s): 17537Problem DescriptionA sub原创 2017-05-01 16:30:34 · 307 阅读 · 0 评论 -
ZOJ - 3777 Problem Arrangement 【状压dp】
Problem ArrangementTime Limit: 2 Seconds Memory Limit: 65536 KBThe 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward is going to arrange the o原创 2017-03-20 17:13:40 · 543 阅读 · 0 评论 -
leetcode 279. Perfect Squares【dp】
279. Perfect SquaresAdd to ListDescription Submission SolutionsTotal Accepted: 66852Total Submissions: 188029Difficulty: MediumContributors: AdminGiven a positive integ原创 2017-02-27 16:04:41 · 294 阅读 · 0 评论 -
POJ 1651 Multiplication Puzzle【区间dp】
Multiplication Puzzle POJ - 1651 思路:求出每个区间的最小值,一直扩散到整个区间 设dp[l][r]表示区间[l,r]的最优解,则状态转移如下: 1、当r-l=2时,dp[l][r] = num[l]*num[l+1]*num[r];2、当r-l>2时,对区间的最后一原创 2017-05-14 22:13:14 · 358 阅读 · 0 评论 -
POJ 2955 Brackets【区间dp】
Brackets POJ - 2955 #include#include#include#include#include#include#include#include#include#includeusing namespace std;#define ll long long#define ms(a原创 2017-05-14 22:04:10 · 266 阅读 · 0 评论 -
HDU 6103 Kirinriki 【dp】
KirinrikiTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1275 Accepted Submission(s): 503Problem DescriptionWe define the dis原创 2017-08-11 15:39:18 · 304 阅读 · 0 评论 -
HDU 5800 To My Girlfriend 【DP】
To My GirlfriendTime Limit: 2000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1342 Accepted Submission(s): 522Problem DescriptionDear Guo原创 2017-07-18 09:48:32 · 297 阅读 · 0 评论 -
HDU 5543 Pick The Sticks【三维dp】
Pick The SticksTime Limit: 15000/10000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 1884 Accepted Submission(s): 601Problem DescriptionThe story原创 2017-07-07 15:41:50 · 299 阅读 · 0 评论 -
HDU 1133 Buy the Ticket【卡特兰数】
Buy the TicketTime Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 11 Accepted Submission(s) : 3Font: Times New Roman | Verdana | Georgia原创 2017-07-06 11:05:53 · 408 阅读 · 0 评论 -
HDU 2067 小兔的棋盘【卡特兰数】
小兔的棋盘Time Limit : 1000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 20 Accepted Submission(s) : 9Font: Times New Roman | Verdana | GeorgiaFont原创 2017-07-05 17:09:09 · 474 阅读 · 0 评论 -
HDU 4165 Pills【卡特兰数】
PillsTime Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 17 Accepted Submission(s) : 10Font: Times New Roman | Verdana | GeorgiaFont原创 2017-07-06 10:23:24 · 426 阅读 · 0 评论 -
HDU 1267 下沙的沙子有几粒?【dp】
下沙的沙子有几粒?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4502 Accepted Submission(s): 2378Problem Description2005年11月份,我们学校参加原创 2017-07-05 11:56:26 · 298 阅读 · 0 评论 -
HDU 3076 ssworld VS DDD 【概率dp】
ssworld VS DDDTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2646 Accepted Submission(s): 530Problem DescriptionOne day, sss原创 2017-07-01 16:12:36 · 325 阅读 · 0 评论 -
ZUFE 2475 kiminonamaewa【区间dp】
dp[i][j]=区间回文子序列的个数。dp[i][j] = dp[i+1][j] + dp[i][j-1] - dp[i+1][j-1];if(str[i] == str[j]) dp[i][j] = dp[i+1][j-1] + 1;不断从内往外推,一旦存在str[i]==str[j]那么要加上dp[i+1][j-1]。#include#include原创 2017-05-13 21:15:22 · 810 阅读 · 0 评论 -
NYOJ 16 矩形嵌套【dp】
矩形嵌套时间限制:3000 ms | 内存限制:65535 KB难度:4描述有n个矩形,每个矩形可以用a,b来描述,表示长和宽。矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当a<c,b<d或者b<c,a<d(相当于旋转X90度)。例如(1,5)可以嵌套在(6,2)内,但不能嵌套在(3,4)中。你的任务是选出尽可能多的矩形排成一行,使得除最后一个外,每一个矩原创 2017-02-24 19:48:39 · 319 阅读 · 0 评论 -
HDU 2084 数塔【dp(递推)+(记忆化)】
数塔Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 41118 Accepted Submission(s): 24431Problem Description在讲述DP算法的时候,一个经典的例子就是数塔问题,原创 2017-02-24 18:21:03 · 394 阅读 · 0 评论 -
ZOJ 3211 Dream City【dp】
Dream CityTime Limit: 1 Second Memory Limit: 32768 KBJAVAMAN is visiting Dream City and he sees a yard of gold coin trees. There are n trees in the yard. Let's call them tree 1, tree 2原创 2017-02-15 21:35:13 · 321 阅读 · 0 评论 -
【蓝桥】算法提高 矩阵乘法
算法提高 矩阵乘法 时间限制:3.0s 内存限制:256.0MB 问题描述 有n个矩阵,大小分别为a0*a1, a1*a2, a2*a3, ..., a[n-1]*a[n],现要将它们依次相乘,只能使用结合率,求最少需要多少次运算。 两个大小分别为p*q和q*r的矩阵相乘时的运算次数计为p*q*r。输入格式 输入的第一行原创 2017-02-05 23:18:09 · 3431 阅读 · 0 评论 -
HDU 2602 Bone Collector
Bone CollectorTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 47894 Accepted Submission(s): 19983Problem DescriptionMany year原创 2016-05-19 20:34:43 · 453 阅读 · 0 评论 -
POJ 2955 Brackets 【区间dp】
BracketsTime Limit: 1000MS Memory Limit: 65536KB 64bit IO Format: %lld & %lluSubmit StatusDescriptionWe give the following inductive definition of a “regular原创 2016-10-03 18:55:42 · 272 阅读 · 0 评论 -
HDU 2844【背包】
CoinsTime Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 63 Accepted Submission(s) : 27Font: Times New Roman | Verdana | GeorgiaFont原创 2016-08-14 00:03:15 · 265 阅读 · 0 评论 -
HDU 3466 Proud Merchants【01dp】
Proud MerchantsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Total Submission(s): 5497 Accepted Submission(s): 2318Problem DescriptionRecently,原创 2016-08-31 16:27:38 · 260 阅读 · 0 评论 -
HDU 4216 Computational Geometry?【dp
Computational Geometry?Time Limit : 6000/3000ms (Java/Other) Memory Limit : 65536/65536K (Java/Other)Total Submission(s) : 1 Accepted Submission(s) : 1Font: Times New Roman | Verdana |原创 2016-08-20 17:42:09 · 627 阅读 · 0 评论 -
HDU Ball
BallTime Limit : 60000/20000ms (Java/Other) Memory Limit : 62768/62768K (Java/Other)Total Submission(s) : 0 Accepted Submission(s) : 0Font: Times New Roman | Verdana | GeorgiaFont原创 2016-08-05 22:26:19 · 635 阅读 · 0 评论 -
HDU 2546 饭卡
饭卡Time Limit : 5000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 62 Accepted Submission(s) : 33Font: Times New Roman | Verdana | GeorgiaFont Si原创 2016-08-05 22:25:32 · 265 阅读 · 0 评论 -
FZU 1502 Letter Deletion
Letter DeletionTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice FZU 1502DescriptionYou are given two words (each word consists原创 2016-08-03 21:06:55 · 282 阅读 · 0 评论 -
【背包专题——01背包】
/******************HDU 2602******************/#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#incl原创 2017-01-17 10:09:54 · 246 阅读 · 0 评论 -
【背包专题——完全背包】
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define rep(i,j,k)for(i=j;原创 2017-01-17 10:47:45 · 376 阅读 · 0 评论 -
【蓝桥】 算法提高 概率计算
算法提高 概率计算 时间限制:1.0s 内存限制:256.0MB 问题描述 生成n个∈[a,b]的随机整数,输出它们的和为x的概率。输入格式 一行输入四个整数依次为n,a,b,x,用空格分隔。输出格式 输出一行包含一个小数位和为x的概率,小数点后保留四位小数样例输入2 1 3原创 2017-01-31 23:22:15 · 338 阅读 · 0 评论 -
HDU 4001 To Miss Our Children Time【dp】
To Miss Our Children TimeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 4662 Accepted Submission(s): 1291Problem Description原创 2017-01-28 13:40:25 · 262 阅读 · 0 评论 -
HDU 1260 Tickets 【dp】
TicketsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3501 Accepted Submission(s): 1767Problem DescriptionJesus, what a grea原创 2017-01-22 18:45:33 · 276 阅读 · 0 评论 -
HDU 1176 免费馅饼【dp】
免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 44940 Accepted Submission(s): 15483Problem Description都说天上不会掉馅饼,但有一天gameb原创 2017-01-22 15:46:35 · 320 阅读 · 0 评论 -
HDU 1257 最少拦截系统【dp】
最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 38006 Accepted Submission(s): 14925Problem Description某国为了防御敌国的导弹袭击,发展出原创 2017-01-21 18:49:46 · 413 阅读 · 2 评论 -
HDU 1087 Super Jumping! Jumping! Jumping!【dp】
Super Jumping! Jumping! Jumping!Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 35625 Accepted Submission(s): 16206Problem Descri原创 2017-01-20 20:54:22 · 253 阅读 · 0 评论