随笔分类 -  ACM_动态规划

上一页 1 2 3 4 下一页
Hanoi双塔问题(递推)
摘要:Hanoi双塔问题 题目描述 给定A,B,C三根足够长的细柱,在A柱上放有2n个中间有空的圆盘,共有n个不同的尺寸,每个尺寸都有两个相同的圆盘,注意这两个圆盘是不加区分的(下图为n=3的情形)。现要将 这些国盘移到C柱上,在移动过程中可放在B柱上暂存。要求: (1)每次只能移动一个圆盘; (2) A 阅读全文
posted @ 2018-03-18 13:11 蔡军帅 阅读(1232) 评论(0) 推荐(0)
校赛热身 Problem C. Sometimes Naive (状压dp)
摘要:题解: 列举每一种3的倍数的组合,开始先求出3条边的可行解,则 六条边的可行解可以由两个三条边得来。 详见代码解析 #include using namespace std; int a[22],n,cnt,ant,is[500007],dp[1050007]; struct node { int num,id; }angle[500007... 阅读全文
posted @ 2018-03-18 11:54 蔡军帅 阅读(210) 评论(0) 推荐(0)
集合的划分(递推)
摘要:集合的划分 题目描述 设S是一个具有n个元素的集合,S=⟨a1,a2,……,an⟩S=⟨a1,a2,……,an⟩ ,现将S划分成k个满足下列条件的子集合S1,S2,……,SkS1,S2,……,Sk ,且满足: 1.Si ≠ ∅ 2.Si ∩ Sj = ∅ (1≤i,j≤k i≠j) 3.S1 ∪ S 阅读全文
posted @ 2018-03-17 23:47 蔡军帅 阅读(297) 评论(0) 推荐(0)
过河卒(Noip2002)(dp)
摘要:过河卒(Noip2002) 题目描述 棋盘上A点有一个过河卒,需要走到目标B点。卒行走的规则:可以向下、或者向右。同时在棋盘上的某一点有一个对方的马(如C点),该马所在的点和所有跳跃一步可达的点称为对方马的控制点,如图3-1中的C点和P1,……,P8,卒不能通过对方马的控制点。棋盘用坐标表示,A点( 阅读全文
posted @ 2018-03-17 23:40 蔡军帅 阅读(121) 评论(0) 推荐(0)
位数问题(dp 递推)
摘要:位数问题 题目描述 在所有的N位数中,有多少个数中有偶数个数字3?由于结果可能很大,你只需要输出这个答案对12345取余的值。 输入 读入一个数N。 输出 输出有多少个数中有偶数个数字3。 样例输入 样例输出 提示 阅读全文
posted @ 2018-03-17 23:35 蔡军帅 阅读(233) 评论(0) 推荐(0)
摆花 (DP动态规划)
摘要:2012_p3 摆花 (flower.cpp/c/pas) 题目描述 3.摆花 (flower.cpp/c/pas) 【问题描述】 小明的花店新开张,为了吸引顾客,他想在花店的门口摆上一排花,共 m 盆。通过调 查顾客的喜好,小明列出了顾客最喜欢的 n 种花,从 1 到 n 标号。为了在门口展出更多 阅读全文
posted @ 2018-03-16 12:53 蔡军帅 阅读(896) 评论(0) 推荐(0)
NOIP2005普及组第3题 采药 (背包问题)
摘要:NOIP2005普及组第3题 采药 题目描述 辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给他出了一个难题。医师把他带到一个到处都是草药的山洞里对他说:“孩子,这个山洞里有一些不同的草药,采每一株都需要一些时间,每一株也有它自身 阅读全文
posted @ 2018-03-15 22:55 蔡军帅 阅读(436) 评论(0) 推荐(0)
2015 浙江省赛B Team Formation (技巧,动归)
摘要:Team Formation For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his univ 阅读全文
posted @ 2018-03-14 12:03 蔡军帅 阅读(598) 评论(0) 推荐(0)
PTA 最大子列和问题(10 分)
摘要:最大子列和问题(10 分) 给定K个整数组成的序列{ N​1​​, N​2​​, ..., N​K​​ },“连续子列”被定义为{ N​i​​, N​i+1​​, ..., N​j​​ },其中 1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, - 阅读全文
posted @ 2018-03-11 15:39 蔡军帅 阅读(1549) 评论(0) 推荐(0)
POJ 2184 Cow Exhibition
摘要:Cow Exhibition Problem Description "Fat and docile, big and dumb, they look so stupid, they aren't much fun..." - Cows with Guns by Dana Lyons The cow 阅读全文
posted @ 2018-02-09 21:20 蔡军帅 阅读(220) 评论(0) 推荐(0)
POJ 2392 Space Elevator
摘要:Space Elevator Problem Description The cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of bloc 阅读全文
posted @ 2018-02-09 20:07 蔡军帅 阅读(126) 评论(0) 推荐(0)
POJ 3666 Making the Grade (线性dp,离散化)
摘要:Making the Grade Problem Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows 阅读全文
posted @ 2018-02-09 17:19 蔡军帅 阅读(256) 评论(0) 推荐(0)
HDU 1950 Bridging signals
摘要:Bridging signals Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3402 Accepted Submission(s): 214 阅读全文
posted @ 2018-02-09 16:05 蔡军帅 阅读(166) 评论(0) 推荐(0)
poj 3181 Dollar Dayz
摘要:Dollar Dayz Problem Description Farmer John goes to Dollar Days at The Cow Store and discovers an unlimited number of tools on sale. During his first 阅读全文
posted @ 2018-02-09 14:59 蔡军帅 阅读(106) 评论(0) 推荐(0)
poj 3046 Ant Counting(多重集组合数)
摘要:Ant Counting Problem Description Bessie was poking around the ant hill one day watching the ants march to and fro while gathering food. She realized t 阅读全文
posted @ 2018-02-09 13:52 蔡军帅 阅读(251) 评论(0) 推荐(0)
POJ 3280 Cheapest Palindrome
摘要:Cheapest Palindrome Problem Description Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He ha 阅读全文
posted @ 2018-02-09 12:28 蔡军帅 阅读(172) 评论(0) 推荐(0)
hdu 1051 Wooden Sticks
摘要:Wooden Sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23703 Accepted Submission(s): 9625 阅读全文
posted @ 2018-02-09 11:15 蔡军帅 阅读(123) 评论(0) 推荐(0)
POJ 3616 Milking Time
摘要:Milking Time Problem Description Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to sche 阅读全文
posted @ 2018-02-08 22:35 蔡军帅 阅读(171) 评论(0) 推荐(0)
poj 2385 Apple Catching
摘要:Apple Catching Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7108 Accepted: 3469 Description It is a little known fact that cows love app 阅读全文
posted @ 2018-02-08 20:04 蔡军帅 阅读(134) 评论(0) 推荐(0)
poj 2229 Sumsets(dp)
摘要:Sumsets Problem Description Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbe 阅读全文
posted @ 2018-02-07 11:57 蔡军帅 阅读(165) 评论(0) 推荐(0)

上一页 1 2 3 4 下一页