动态规划
文章平均质量分 73
nudt_oys
An AC a day,keeps WA away~
展开
-
LightOJ 1265 Island of Survival(概率DP)
1265 - Island of SurvivalYou are in a reality show, and the show is way too real that they threw into an island. Only two kinds of animals are in the island, the tigers and the deer. Though un原创 2016-08-09 15:02:38 · 484 阅读 · 0 评论 -
POJ 2385 Apple Catching(基础DP)
Apple CatchingDescriptionIt is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessi原创 2016-07-11 18:03:59 · 528 阅读 · 0 评论 -
POJ 3616 Milking Time(基础DP)
Milking TimeDescriptionBessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,000) hours (conve原创 2016-07-12 20:12:16 · 493 阅读 · 0 评论 -
POJ 1159 Palindrome(基础DP)
PalindromeDescriptionA palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You are to write a program which, given a st原创 2016-07-16 18:40:00 · 301 阅读 · 0 评论 -
UVaOJ 580 Critical Mass(基础DP)
During the early stages of the Manhattan Project, the dangers of the new radioctive materials werenot widely known. Vast new factory cities were built to manufacture uranium and plu- tonium in bulk.Co原创 2016-07-29 22:35:02 · 497 阅读 · 0 评论 -
UVaOJ 12563 Jin Ge Jin Qu hao(01背包)
(If you smiled when you see the title, this problem is for you ^_^)For those who don’t know KTV, see: http://en.wikipedia.org/wiki/Karaoke_boxThere is one very popular song called Jin Ge Jin Qu().原创 2016-07-29 21:12:47 · 503 阅读 · 0 评论 -
POJ 2533 Longest Ordered Subsequence(基础DP)
Longest Ordered SubsequenceDescriptionA numeric sequence of ai is ordered if a1 a2 aN. Let the subsequence of the given numeric sequence (a1, a2, ..., aN) be any sequence (ai1, ai2, ...,原创 2016-07-29 21:04:14 · 231 阅读 · 0 评论 -
CSUOJ 1592 石子归并(区间DP)
1592: 石子归并Description现在有n堆石子,第i堆有ai个石子。现在要把这些石子合并成一堆,每次只能合并相邻两个,每次合并的代价是两堆石子的总石子数。求合并所有石子的最小代价。Input第一行包含一个整数T(T每组数据第一行包含一个整数n(2第二行包含n个正整数ai(aiOutput每原创 2016-08-01 21:04:54 · 553 阅读 · 1 评论 -
CSUOJ 1587 爬楼梯
1587: 爬楼梯Description小时候我们都玩过爬楼梯的游戏:两人猜拳,赢了可向上爬一级,谁先到最高级则获胜。作为大学生,我们应该玩一个更有水平的游戏。现在一个人要上n级楼梯,每一步可以选择上一级或者上两级,但是不能后退。求上这n级楼梯的方案数。Input第一行只有一个整数T(1下面的T行每一行有一个整数n(1原创 2016-07-29 20:57:14 · 734 阅读 · 0 评论 -
CSUOJ 1729 齿轮传动(基础DP)
1729: 齿轮传动Description你在一家机械厂打工,你的老板让你把一组齿轮种类序列a1,a2,..,an取走几个让齿轮的传动比为1:1,老板要求你取走最少的齿轮,不能改变齿轮原来的相对位置,满足条件,即齿轮种类组合起来是回文串。Input多组数据,第一行有一个整数T , 表示有T组数据。(T以下每组数据第一行原创 2016-07-12 21:27:28 · 1721 阅读 · 0 评论 -
LeetCode 62 Unique Paths(记忆化搜索)
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).How many possible unique pa原创 2017-05-12 08:30:23 · 525 阅读 · 0 评论 -
LeetCode 72 Edit Distance(动态规划)
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitted on a word:原创 2017-05-13 09:36:25 · 654 阅读 · 0 评论 -
LeetCode 70 Climbing Stairs(记忆化搜索)
You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n will be a positive原创 2017-05-13 13:09:34 · 1146 阅读 · 0 评论 -
LeetCode 64 Minimum Path Sum(动态规划)
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move either down or right at原创 2017-05-13 22:16:29 · 836 阅读 · 0 评论 -
LeetCode 198 House Robber(基础DP)
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house原创 2017-07-15 21:29:17 · 751 阅读 · 0 评论 -
POJ 3176 Cow Bowling(基础DP)
Cow BowlingDescriptionThe cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-pin-like triangl原创 2016-07-11 15:52:07 · 404 阅读 · 0 评论 -
POJ 1088 滑雪(记忆化搜索)
滑雪DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25原创 2016-07-13 11:24:09 · 576 阅读 · 0 评论 -
POJ 2229 Sumsets(数位DP)
SumsetsDescriptionFarmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power of 2. Here are the原创 2016-08-03 21:07:02 · 284 阅读 · 0 评论 -
POJ 3661 Running(区间DP)
RunningDescriptionThe cows are trying to become better athletes, so Bessie is running on a track for exactly N (1 ≤ N ≤ 10,000) minutes. During each minute, she can choose to either run or原创 2016-08-02 22:20:16 · 532 阅读 · 0 评论 -
CodeForces 148D Bag of mice(概率DP)
D. Bag of miceThe dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while t原创 2016-08-02 23:20:33 · 323 阅读 · 0 评论 -
HDOJ 3466 Proud Merchants(贪心 + 01背包)
Proud MerchantsProblem DescriptionRecently, iSea went to an ancient country. For such a long time, it was the most wealthy and powerful kingdom in the world. As a result, the people in t原创 2016-08-02 22:06:21 · 393 阅读 · 0 评论 -
POJ 3280 Cheapest Palindrome(区间DP)
Cheapest PalindromeDescriptionKeeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID tag tha原创 2016-08-02 21:50:40 · 490 阅读 · 0 评论 -
UVaOJ 10003 Cutting Sticks(区间DP)
You have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machinery,Inc. (ACM), charges money according to the length of the stick being cut. Their procedure of workreq原创 2016-08-02 17:21:09 · 398 阅读 · 0 评论 -
POJ 1651 Multiplication Puzzle(区间DP)
Multiplication PuzzleDescriptionThe multiplication puzzle is played with a row of cards, each containing a single positive integer. During the move player takes one card out of the row and原创 2016-08-01 16:22:30 · 293 阅读 · 0 评论 -
HDOJ 3583 LOOPS(期望DP)
LOOPSProblem DescriptionAkemi Homura is a Mahou Shoujo (Puella Magi/Magical Girl).Homura wants to help her friend Madoka save the world. But because of the plot of the Boss Incubator原创 2016-07-31 23:44:42 · 341 阅读 · 0 评论 -
HDOJ 4405 Aeroplane chess(期望DP)
Aeroplane chessProblem DescriptionHzz loves aeroplane chess very much. The chess map contains N+1 grids labeled from 0 to N. Hzz starts at grid 0. For each step he throws a dice(a dice h原创 2016-07-31 23:04:12 · 354 阅读 · 0 评论 -
POJ 2096 Collecting Bugs(期望DP)
Collecting BugsDescriptionIvan is fond of collecting. Unlike other people who collect post stamps, coins or other material stuff, he collects software bugs. When Ivan gets a new program, h原创 2016-07-31 23:25:14 · 298 阅读 · 0 评论 -
SGU 495 Kids and Prizes(期望DP || 数学规律)
Kids and PrizesDescriptionICPC (International Cardboard Producing Company) is in the business of producing cardboard boxes. Recently the company organized a contest for kids fo原创 2016-07-31 22:32:14 · 539 阅读 · 0 评论 -
HDOJ 1712 ACboy needs your help(分组背包)
ACboy needs your helpProblem DescriptionACboy has N courses this term, and he plans to spend at most M days on study.Of course,the profit he will gain from different course depending on原创 2016-07-29 23:52:38 · 360 阅读 · 0 评论 -
HDOJ 2159 FATE
FATEProblem Description最近xhd正在玩一款叫做FATE的游戏,为了得到极品装备,xhd在不停的杀怪做任务。久而久之xhd开始对杀怪产生的厌恶感,但又不得不通过杀怪来升完这最后一级。现在的问题是,xhd升掉最后一级还需n的经验值,xhd还留有m的忍耐度,每杀一个怪xhd会得到相应的经验,并减掉相应的忍耐度。当忍耐度降到0或者0以下时,xhd就不会玩这游原创 2016-07-29 20:47:03 · 278 阅读 · 0 评论 -
POJ 1458 Common Subsequence
Common SubsequenceDescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequen原创 2016-07-28 23:59:29 · 283 阅读 · 0 评论 -
CCF CSP 2016年12月第4题 压缩编码(区间DP)
问题描述试题编号:201612-4试题名称:压缩编码时间限制:3.0s内存限制:256.0MB问题描述:问题描述 给定一段文字,已知单词a1, a2, …, an出现的频率分别t1, t2, …, tn。可以用01串给这些单词编码,即将每个单词与一个01串对原创 2017-10-10 16:59:44 · 1168 阅读 · 0 评论