动态规划
文章平均质量分 72
古宇hhhh
一直想着自己的梦
展开
-
UVA 11400 Lighting System Design
#include#include#includeusing namespace std;#define N 100005#define inf 0x3f3f3f3fint dp[N];struct data{ int v,k,c,l;///电压 电源费用 灯泡费用 数量 friend bool operator <(data a,data b) {原创 2017-10-25 12:41:44 · 207 阅读 · 0 评论 -
poj 3311 状压dp+float
Hie with the PieTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8134 Accepted: 4426DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to原创 2017-09-09 19:47:49 · 200 阅读 · 0 评论 -
poj 1185 炮兵布阵 状压dp
炮兵阵地Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 29250 Accepted: 11331Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可原创 2017-09-08 18:28:06 · 206 阅读 · 0 评论 -
poj 1661 Help Jimmy (逆推)
Making the GradeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7782 Accepted: 3637DescriptionA straight dirt road connects two fields on FJ's farm, but原创 2017-08-30 21:08:00 · 194 阅读 · 0 评论 -
poj 3254 Corn Fields (状压dp)
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 16619 Accepted: 8768DescriptionFarmer John has purchased a lush new rectangular pasture compo原创 2017-09-08 00:08:10 · 353 阅读 · 0 评论 -
hdu 2859 Phalanx(二位动态规划)
PhalanxTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2064 Accepted Submission(s): 1014Problem DescriptionToday is army day原创 2017-08-29 21:36:12 · 247 阅读 · 0 评论 -
poj 3616 Milking Time
Milking TimeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10593 Accepted: 4435DescriptionBessie is such a hard-working cow. In fact, she is so focused原创 2017-08-29 16:54:35 · 200 阅读 · 0 评论 -
hdu 1176 免费馅饼 (动态规划)
免费馅饼Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 52705 Accepted Submission(s): 18485Problem Description都说天上不会掉馅饼,但有一天gameb原创 2017-08-29 16:10:35 · 225 阅读 · 0 评论 -
hdu 1074 Doing Homework (状压dp)
Doing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10029 Accepted Submission(s): 4800Problem DescriptionIgnatius h原创 2017-08-28 21:02:22 · 216 阅读 · 0 评论 -
hdu 1078 FatMouse and Cheese (深度优先搜索+dp)
FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 11156 Accepted Submission(s): 4731Problem DescriptionFatMo原创 2017-08-28 16:21:27 · 211 阅读 · 0 评论 -
hdu 1160 FatMouse's Speed(最长上升子序列路径输出)
Problem DescriptionFatMouse 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 p原创 2017-08-26 19:21:00 · 247 阅读 · 0 评论 -
poj 3666 Making the Grade (离散化+动态规划)
Making the GradeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7794 Accepted: 3639DescriptionA straight dirt road connects two fields on FJ's farm, but原创 2017-08-31 21:35:38 · 344 阅读 · 0 评论 -
hdu FATE 费用dp
FATETime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15502 Accepted Submission(s): 7315Problem Description最近xhd正在玩一款叫做FATE的游戏,原创 2017-09-10 08:26:34 · 256 阅读 · 0 评论 -
hdu 2577 How to Type 经典 二维 dp
How to TypeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7246 Accepted Submission(s): 3286Problem DescriptionPirates have f原创 2017-09-10 09:29:45 · 200 阅读 · 0 评论 -
UVA 12563 Jin Ge Jin Qu hao
题目分析:最多的唱歌次数数据水,只是卡空间范围但是没有卡时间范围。利用完全背包的思想每次截取一个。for(int i=1; i<=n; i++) { for(int j=t-1; j>=a[i]; j--) { dp[j]=max(dp[j],dp[j-a原创 2017-10-23 23:50:24 · 165 阅读 · 0 评论 -
UVA 1025A Spy in the Metro 动态规划 _ SPFA
传送门DescriptionSecret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station of Algorithms City原创 2017-10-23 17:54:37 · 243 阅读 · 0 评论 -
DAG 动态规划 -- 硬币问题
#include#includeusing namespace std;#define N 1005int dp[N];int a[N];int main(){ memset(dp,0,sizeof(dp));///dp[i] 存储从0 到i所需要的最小(inf)/最大硬币数(0) int n,Aims;/// n : 硬币的种类数 Aims 目标值 scan原创 2017-10-22 10:47:47 · 266 阅读 · 0 评论 -
NYoj 16 矩形嵌套 (DAG上最长路 - 动态规划)
矩形嵌套时间限制: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-10-22 10:30:00 · 216 阅读 · 0 评论 -
hdu 1004 Max Sum 基础dp
题目链接最大子序列和。输出起始位置。#include#include#includeusing namespace std;#define N 100005#define inf 0x3f3f3f3fint a[N];int dp[N];int pre[N];int main(){ int T,iCase=0; sca原创 2017-10-29 19:35:17 · 295 阅读 · 0 评论 -
UVA 116 Unidirectional TSP
记录路径。。字典序最大。。#include#include#includeusing namespace std;#define N 1005#define inf 0x3f3f3f3fint Next[N][N];int maps[N][N];int dp[N][N];int main(){ int n,m; while(~scanf(原创 2017-10-21 13:05:52 · 165 阅读 · 0 评论 -
UVA 1347 Tour (双调欧几里得旅行商问题)
dfs 版dp#include#include#include#includeusing namespace std;#define N 1005double x[N];double y[N];double d[N][N];int n;double dis(int i,int j){ return hypot(x[i]-x[j],y[i]-y[j]);}///原创 2017-10-20 23:52:55 · 243 阅读 · 0 评论 -
Gym - 101149F The Weakest Sith (结构体排序)
The Weakest Sithtime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputIn a galaxy far, far away the great galactic empire h原创 2017-09-02 21:06:47 · 317 阅读 · 0 评论 -
Gym - 101149H Streets of Working Lanterns (括号匹配)
H. Streets of Working Lanternstime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputPoliceman Anatoliy monitors a lair of u原创 2017-09-02 21:02:04 · 500 阅读 · 1 评论 -
hdu 1513 Palindrome (滚动数组处理回文串)
PalindromeTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6433 Accepted Submission(s): 2127Problem DescriptionA palindrome is原创 2017-09-10 10:02:05 · 210 阅读 · 0 评论 -
长沙理工大学第十二届ACM大赛 G 跑路 ing (概率dp)
题目描述vigoss18 辞职成功终于逃出了公司,但是没过太久,公司就发现vigoss18 的所作所为,于是派人来把他抓回去。vigoss18 必须一直跑路,躲避公司的围捕。可以抽象的看成一个有向图,图中可能存在重边和自环。刚开始他站在位置1,每单位时间vigoss18 必须从目前站的位置,等概率选择一条边然后移动到对应的节点上去或者不动(如果当前节点有t条边,则有1/原创 2017-09-05 16:04:27 · 379 阅读 · 0 评论 -
poj 3186 Treats for the Cows (区间dp)
Treats for the CowsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6468 Accepted: 3390DescriptionFJ has purchased N (1 The treats are interesting fo原创 2017-08-27 12:36:32 · 207 阅读 · 0 评论 -
hdu 1260 Tickets 水题dp
TicketsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4923 Accepted Submission(s): 2568Problem DescriptionJesus, what a grea原创 2017-08-26 20:01:04 · 200 阅读 · 0 评论 -
hdu 2089 不要62 (数位dp)
不要62Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 42263 Accepted Submission(s): 15430Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音原创 2017-05-13 11:05:52 · 152 阅读 · 0 评论 -
FZU - 2214 Knapsack problem (dp(对价值dp))
Given a set of n items, each with a weight w[i] and a value v[i], determine a way to choose the items into a knapsack so that the total weight is less than or equal to a given limit B and the total va原创 2017-05-01 11:00:33 · 245 阅读 · 0 评论 -
D - Beauty of Array ZOJ - 3872
题意:给你N个数让你求他的连续子序列的和若一个连续子序列中出现重复项就不算。。子序列2 3 3 的值为5eg: 1 2 3dp是从前慢慢往后走的。。。别急啊。。dp[1]=包含 1 :1dp[2]=包含 2 : 2 | 1 2dp[3]=包含 3 : 3 | 2 3 | 1 2 3ans=dp[1]+dp[2]+dp[3];dp[i]=a[i原创 2017-04-30 13:42:14 · 240 阅读 · 0 评论 -
Hrbust 哈理工 oj 2317 Game (完全背包)
GameTime Limit: 1000 MSMemory Limit: 100000 KTotal Submit: 139(51 users)Total Accepted: 61(45 users)Rating: Special Judge: NoDescriptionKim原创 2017-04-28 13:22:17 · 405 阅读 · 0 评论 -
fzu 花生序列
强大的dp二维数组水数据水过///花生的序列 FAQ | About | Google Group | Discuss | Author #include#define mod 1000000007#include#includeusing namespace std;int dp原创 2017-02-15 16:22:25 · 194 阅读 · 0 评论 -
hrbust 哈理工 2252 完全背包模板题
世界Time Limit: 10000 MSMemory Limit: 32768 KTotal Submit: 151(51 users)Total Accepted: 56(41 users)Rating: Special Judge: NoDescription世界是一个非原创 2017-01-25 00:23:58 · 505 阅读 · 0 评论 -
hrbust 2181
数位dp动态规划 的一种用法dp[i][j]i代表第几位j代表的这个位置元素的名称我们需要遍历除在p,q内不同的元素加起来到i位无聊的小明Time Limit: 3000 MSMemory Limit: 32768 KTotal Submit: 63(34 users)Total Accepted:原创 2017-02-12 11:54:21 · 248 阅读 · 0 评论 -
hrbust 哈理工 1289 编辑距离
状态转移方程dp[i][j]=min(min(dp[i-1][j]+1,dp[i][j-1]+1),dp[i-1][j-1]+c);i代表a字符串j代表b字符串c起判断作用判断的是a[i]是否等于b[j]每一次的移动代表的是对应位置最少移动几次分别判断编辑距离Time Limit: 1000 MSMemory Limit:原创 2017-01-22 01:50:03 · 174 阅读 · 0 评论 -
hrbust 1597 序列问题II
序列问题II Time Limit: 1000 MS Memory Limit: 32768 K Total Submit: 202(90 users) Total Accepted: 95(83 users) Rating: Special Judge: No Description 给一个长度为n的整数序列A0,A1,……An-1,找出最长的非递增子序列的长度 Input原创 2017-01-17 11:47:01 · 574 阅读 · 0 评论 -
hrbust 1216
数的划分 Time Limit: 1000 MS Memory Limit: 65535 K Total Submit: 184(89 users) Total Accepted: 125(87 users) Rating: Special Judge: No Description 将整数n分成k份,且每份不能为空,任意两份不能相同(不考虑顺序)。 例如:n=7,k=3,下面转载 2017-01-17 00:16:08 · 360 阅读 · 0 评论 -
hrbust 2143 积分大小(dp)
积分大小Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 28(23 users)Total Accepted: 16(16 users)Rating: Special Judge: NoDescription暑期集训开始原创 2017-05-09 11:50:27 · 422 阅读 · 4 评论 -
hdu 1003 Max num (动态规划)
电子科技大学! Max SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 246047 Accepted Submission(s): 58108Problem Descriptio原创 2017-06-05 21:44:41 · 230 阅读 · 0 评论 -
hebust 1214 方格取数 (多进程dp)
方格取数Time Limit: 1000 MSMemory Limit: 65535 KTotal Submit: 319(71 users)Total Accepted: 92(59 users)Rating: Special Judge: NoDescription 设有N*原创 2017-06-09 21:33:31 · 396 阅读 · 0 评论