
[ACM]_动态规划
同学少年
没有什么不可能!
展开
-
[ACM] SDUT 2607 Mountain Subsequences
Mountain SubsequencesTime Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^题目描述Coco is a beautiful ACMer girl living in a very beautiful mountain. There are many trees and flowers on the原创 2015-04-07 20:21:14 · 1604 阅读 · 0 评论 -
hihoCoder挑战赛7 1001 正则表达式 (区间DP)
http://hihocoder.com/contest/challenge7/problem/1描述给定一个字符串,判断其是否为合法的正则表达式。 一个正则表达式定义为: 1:0是正则表达式,1也是正则表达式。 2:P和Q都是正则表达式,则PQ是正则表达式。 3:P是正则表达式,则(P)是正则表达式 4:P是正则表达式,则P*也是正则表达式 5:P和Q都是原创 2015-04-05 20:12:55 · 1842 阅读 · 0 评论 -
简单动态规划两题(思想一样)
ZOJ 3725 Painting Storages DP计数Painting StoragesTime Limit: 2 Seconds Memory Limit: 65536 KBThere is a straight highway with N storages alongside it labeled by 1,2,3,...,N原创 2015-03-25 17:10:28 · 1707 阅读 · 0 评论 -
[ACM] hihoCoder 1075 开锁魔法III (动态规划,组合数学)
描述一日,崔克茜来到小马镇表演魔法。其中有一个节目是开锁咒:舞台上有 n 个盒子,每个盒子中有一把钥匙,对于每个盒子而言有且仅有一把钥匙能打开它。初始时,崔克茜将会随机地选择 k 个盒子用魔法将它们打开。崔克茜想知道最后所有盒子都被打开的概率,你能帮助她回答这个问题吗?输入第一行一个整数 T (T ≤ 100)表示数据组数。 对于每组数据,第一行有两个整数 n 和 k (1 ≤原创 2014-11-13 20:50:04 · 2646 阅读 · 0 评论 -
[ACM] POJ 2342 Anniversary party (树形DP入门题)
Anniversary partyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4410 Accepted: 2496DescriptionThere is going to be a party to celebrate the 80-th Ann原创 2014-10-28 11:27:54 · 3577 阅读 · 3 评论 -
[ACM] HDU 5074 Hatsune Miku (简单DP)
Hatsune MikuProblem DescriptionHatsune Miku is a popular virtual singer. It is very popular in both Japan and China. Basically it is a computer software that allows you to compose a song on yo原创 2014-10-23 10:23:58 · 2483 阅读 · 0 评论 -
[ACM] FZU 2092 收集水晶 (DFS,记忆化搜索)
Problem Descriptionshadow来到一片神奇的土地,这片土地上不时会出现一些有价值的水晶,shadow想要收集一些水晶带回去,但是这项任务太繁杂了,于是shadow让自己的影子脱离自己并成为一个助手来帮助自己收集这些水晶。shadow把这片土地划分成n*m个小方格,某些格子会存在一些shadow和他的影子都无法穿越的障碍,比如巨石、树木、野兽等。shadow预先探测到原创 2014-10-22 11:13:37 · 1908 阅读 · 0 评论 -
[ACM] HDU 5025 Saving Tang Monk (状态压缩,BFS)
Saving Tang MonkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 941 Accepted Submission(s): 352Problem Description《Journey to t原创 2014-10-21 22:12:12 · 2683 阅读 · 0 评论 -
[ACM] HDU 1400 Mondriaan's Dream (状态压缩,长2宽1长方形铺满)
Mondriaan's DreamTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 783 Accepted Submission(s): 506Problem Description Squares原创 2014-10-10 09:08:36 · 1844 阅读 · 0 评论 -
[ACM] HDU 1227 Fast Food (经典Dp)
Fast FoodTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2173 Accepted Submission(s): 930Problem DescriptionThe fastfood chain原创 2014-10-09 15:35:04 · 2772 阅读 · 0 评论 -
[ACM] hdu 5045 Contest (状态压缩Dp)
ContestProblem DescriptionIn the ACM International Collegiate Programming Contest, each team consist of three students. And the teams are given 5 hours to solve between 8 and 12 programming pr原创 2014-10-01 15:32:29 · 1740 阅读 · 0 评论 -
[ACM] POJ 3254 Corn Fields(状态压缩)
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 8062 Accepted: 4295DescriptionFarmer John has purchased a lush new rectangular pasture compos原创 2014-10-01 10:48:00 · 1758 阅读 · 0 评论 -
[ACM] hdu 5001 Walk (概率DP)
WalkProblem DescriptionI used to think I could be anything, but now I know that I couldn't do anything. So I started traveling.The nation looks like a connected bidirectional graph, and原创 2014-09-17 17:23:32 · 1828 阅读 · 0 评论 -
[ACM] ural 1057 Amount of degrees (数位统计)
1057. Amount of DegreesTime limit: 1.0 secondMemory limit: 64 MBCreate a code to determine the amount of integers, lying in the set [X;Y] and being a sum of exactlyK different integer de原创 2014-08-07 17:14:01 · 1984 阅读 · 0 评论 -
[ACM] POJ 2677 Tour (动态规划,双调欧几里得旅行商问题)
TourTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 3585 Accepted: 1597DescriptionJohn Doe, a skilled pilot, enjoys traveling. While on vacation, he r原创 2014-08-07 10:05:18 · 3266 阅读 · 0 评论 -
[ACM] POJ 2593 Max Sequence (动态规划,最大字段和)
Max SequenceTime Limit: 3000MS Memory Limit: 65536KTotal Submissions: 15569 Accepted: 6538DescriptionGive you N integers a1, a2 ... aN (|ai| You should ou原创 2014-08-06 10:47:59 · 2442 阅读 · 0 评论 -
[ACM] POJ 2479 Maximum sum (动态规划求不相交的两段子段和的最大值)
Maximum sumTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 33363 Accepted: 10330DescriptionGiven a set of n integers: A={a1, a2,..., an}, we define a原创 2014-08-06 10:42:37 · 3728 阅读 · 0 评论 -
[ACM] POJ 1141 Brackets Sequence (区间动态规划)
Brackets SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 25087 Accepted: 7069 Special JudgeDescriptionLet us define a regular brackets seq原创 2014-08-06 10:02:15 · 2388 阅读 · 0 评论 -
[BestCoder Round #3] hdu 4909 String (状压,计数)
StringProblem DescriptionYou hava a non-empty string which consists of lowercase English letters and may contain at most one '?'. Let's choose non-empty substring G from S (it can be G = S原创 2014-08-05 16:56:34 · 2092 阅读 · 0 评论 -
[ACM] hdu 4248 A Famous Stone Collector (DP+组合)
A Famous Stone CollectorProblem DescriptionMr. B loves to play with colorful stones. There are n colors of stones in his collection. Two stones with the same color are indistinguishable. M原创 2014-07-30 15:15:56 · 1907 阅读 · 0 评论 -
[ACM] ZOJ 3725 Painting Storages (DP计数+组合)
Painting StoragesTime Limit: 2 Seconds Memory Limit: 65536 KBThere is a straight highway with N storages alongside it labeled by 1,2,3,...,N. Bob asks you to paint all storages with two原创 2014-07-25 14:01:52 · 2027 阅读 · 0 评论 -
[ACM] n个数分为m部分,要求每部分的和乘起来积最大(区间DP)
A - 爱管闲事春希非常爱管闲事,他每天都会抽空帮助一些同学,由于春希非常死板,出于公平性,春希不会先帮助后来找他的同学。现在有n个同学需要他的帮助,虽然他很想一天之类帮助所有人,但毕竟精力有限,于是他决定分m天来帮助他们。根据事情的重要性,春希帮助不同同学会有不同的快乐值,而春希获得的总的快乐值为每天获得的快乐值的乘积。现在给出n和m,以及帮助完各同学时获得的快乐值,原创 2014-05-27 20:56:21 · 3320 阅读 · 7 评论 -
2014年百度之星程序设计大赛 - 资格赛 1002 Disk Schedule(双调欧几里得旅行商问题)
Problem Description有很多从磁盘读取数据的需求,包括顺序读取、随机读取。为了提高效率,需要人为安排磁盘读取。然而,在现实中,这种做法很复杂。我们考虑一个相对简单的场景。磁盘有许多轨道,每个轨道有许多扇区,用于存储数据。当我们想在特定扇区来读取数据时,磁头需要跳转到特定的轨道、具体扇区进行读取操作。为了简单,我们假设磁头可以在某个轨道顺时针或逆时针匀速旋转,旋转一周的时间是36原创 2014-05-20 08:11:29 · 2540 阅读 · 0 评论 -
2014年百度之星程序设计大赛 - 资格赛 1004 Labyrinth(Dp)
LabyrinthTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 519 Accepted Submission(s): 174Problem Description度度熊是一只喜欢探险的熊,一次偶然落原创 2014-05-16 19:13:24 · 2618 阅读 · 0 评论 -
[2013山东ACM省赛] The number of steps (概率DP,数学期望)
The number of stepsTime Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^题目描述 Mary stands in a strange maze, the maze looks like a triangle(the first layer have one room,the seco原创 2014-05-05 17:53:54 · 2569 阅读 · 0 评论 -
[ACM] poj 2096 Collecting Bugs (概率DP,期望)
Collecting BugsTime Limit: 10000MS Memory Limit: 64000KTotal Submissions: 2026 Accepted: 971Case Time Limit: 2000MS Special JudgeDescriptionIvan is fond o原创 2014-05-05 15:30:56 · 2163 阅读 · 0 评论 -
[ACM] hdu 1260 Tickets (动态规划)
TicketsTime Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 4 Accepted Submission(s) : 2Font: Times New Roman | Verdana | GeorgiaFont Size: ←原创 2014-05-03 14:12:45 · 2496 阅读 · 0 评论 -
[ACM] hdu 1231 最大连续子序列 (动规复习)
代码:#include #include #include #include using namespace std;const int maxn=10003;const int inf=0x7fffffff;int num[maxn];int n;int main(){ while(scanf("%d",&n)!=EOF&&n)原创 2014-05-03 09:22:01 · 1481 阅读 · 0 评论 -
[ACM] hdu 1087 Super Jumping! Jumping! Jumping! (动态规划)
Super Jumping! Jumping! Jumping!Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 6 Accepted Submission(s) : 5Font: Times New Roman | Verdan原创 2014-05-02 20:26:19 · 1852 阅读 · 0 评论 -
[ACM] hdu 1029 Ignatius and the Princess IV (动归或hash)
Ignatius and the Princess IVTime Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32767K (Java/Other)Total Submission(s) : 7 Accepted Submission(s) : 3Font: Times New Roman | Verdana |原创 2014-05-02 16:07:03 · 2316 阅读 · 0 评论 -
[ACM] hdu 1003 Max Sum(最大子段和模型)
Max SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 135262 Accepted Submission(s): 31311Problem Description Given a sequen原创 2014-04-30 09:33:13 · 1798 阅读 · 0 评论 -
[ACM] 九度OJ 合唱队形 (最长递增子序列改版)
题目1131:合唱队形 时间限制:1 秒内存限制:32 兆特殊判题:否提交:1680解决:520题目描述: N位同学站成一排,音乐老师要请其中的(N-K)位同学出列,使得剩下的K位同学不交换位置就能排成合唱队形。合唱队形是指这样的一种队形:设K位同学从左到右依次编号为1, 2, …, K,他们的身高分别为T1, T2, …, TK,则他们的身高满原创 2014-04-29 20:59:02 · 1956 阅读 · 0 评论 -
[ACM] poj 1700 Crossing River (经典过河问题)
Crossing RiverTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10212 Accepted: 3855DescriptionA group of N people wishes to go across a river with only one原创 2014-04-29 16:11:03 · 4474 阅读 · 0 评论 -
[ACM] hdu 1203 I NEED A OFFER!(小数背包)
解题思路:求至少收到一份OFFER的最大概率,为了简化问题,求一份OFFER也没有收到的最小概率,然后1减去它就可以了。采用01背包,装入一份OFFER也没收到总概率的最小值,那么1减去它就是收到至少一份OFFER的最大概率。注意:dp[最大容量] 要有值,初始化时,而且本题dp数组初始化值为1代码:#include #include #include using name原创 2014-04-29 11:41:29 · 1669 阅读 · 0 评论 -
[ACM] hdu 1025 Constructing Roads In JGShining's Kingdom (最长递增子序列,lower_bound使用)
Constructing Roads In JGShining's KingdomTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 14635 Accepted Submission(s): 4158Proble原创 2014-04-28 16:36:35 · 2205 阅读 · 0 评论 -
[2012山东ACM省赛] Pick apples (贪心,完全背包,枚举)
Pick applesTime Limit: 1000MS Memory limit: 165536K题目描述Once ago, there is a mystery yard which only produces three kinds of apples. The number of each kind is infinite. A girl carrying a原创 2014-04-28 14:13:57 · 2864 阅读 · 0 评论 -
[ACM] Hrbustoj 1376 能量项链 (区间动态规划)
能量项链Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 55(20 users)Total Accepted: 22(19 users)Rating: Special Judge: NoDescription原创 2014-04-26 16:20:34 · 3950 阅读 · 0 评论 -
[ACM] 携程预赛第一场 括号匹配 (动态规划)
括号匹配Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 110 Accepted Submission(s) : 46Font: Times New Roman | Verdana | GeorgiaFont Size: ←原创 2014-04-22 20:44:42 · 2814 阅读 · 0 评论 -
[ACM] poj 1141 Brackets Sequence (动态规划)
Brackets SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 23884 Accepted: 6727 Special JudgeDescriptionLet us define a regular brackets sequenc原创 2014-04-22 20:39:15 · 1903 阅读 · 0 评论 -
[ACM] hdu 2844 Coins (多重背包)
CoinsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6347 Accepted Submission(s): 2589Problem Description Whuacmers use coins原创 2014-04-22 11:28:41 · 1806 阅读 · 0 评论