
----其他dp
文章平均质量分 82
_Occult_
物語が始まった
展开
-
POJ 2411 Mondriaan's Dream
DescriptionSquares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his 'toilet series' (where he had to use his toilet paper to draw原创 2015-04-03 11:47:23 · 407 阅读 · 0 评论 -
POJ 1141 Brackets Sequence
DescriptionLet us define a regular brackets sequence in the following way: 1. Empty sequence is a regular sequence. 2. If S is a regular sequence, then (S) and [S] are both regular sequenc原创 2015-04-02 21:39:03 · 424 阅读 · 0 评论 -
HDU 5194 DZY Loves Balls
Problem DescriptionThere are n black balls and m white balls in the big box.Now, DZY starts to randomly pick out the balls one by one. It forms a sequence S. If at the i-th operation,原创 2015-03-28 23:37:30 · 663 阅读 · 0 评论 -
UVA 10003 Cutting Sticks
点击打开链接区间dp问题,搞清楚转移方程就好了,一段区间的最小值就是两段之和加上区间的长度。#include #include#include#include#include#includeusing namespace std;const int maxn = 60;int i, j, k, n, f[maxn][maxn], length, a[maxn];int原创 2015-02-17 20:52:10 · 343 阅读 · 0 评论 -
UVA 620 Cellular Structure
A chain of connected cells of two types A and B composes a cellular structure of some microorganisms of species APUDOTDLS.If no mutation had happened during growth of an organism, its cellular cha原创 2015-02-17 21:28:57 · 440 阅读 · 0 评论 -
UVA 116 Unidirectional TSP
BackgroundProblems that require minimum paths through some domain appear in many different areas of computer science. For example, one of the constraints in VLSI routing problems is minimizing wir原创 2015-02-17 21:00:05 · 829 阅读 · 0 评论 -
UVA 531 Compromise
In a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulfilled, and this is not a trivial task for the countries (maybe except原创 2015-02-17 21:13:53 · 447 阅读 · 0 评论 -
UVa 103 Stacking Boxes
BackgroundSome concepts in Mathematics and Computer Science are simple in one or two dimensions but become more complex when extended to arbitrary dimensions. Consider solving differential equatio原创 2015-02-17 20:43:09 · 401 阅读 · 0 评论 -
UVA 825 Walking on the Safe Side
Square City is a very easy place for people to walk around. The two-way streets run North-South or East-West dividing the city into regular blocks. Most street intersections are safe for pedestrians原创 2015-02-17 21:31:37 · 382 阅读 · 0 评论 -
UVA 10404 Bachet's Game
Bachet's GameBachet's game is probably known to all but probably not by this name. Initially there are n stones on the table. There are two players Stan and Ollie, who move alternately. Stan alw原创 2015-02-17 21:21:32 · 444 阅读 · 0 评论 -
UVA 674 Coin Change
Suppose there are 5 types of coins: 50-cent, 25-cent, 10-cent, 5-cent, and 1-cent. We want to make changes with these coins for a given amount of money.For example, if we have 11 cents, then原创 2015-02-17 20:48:34 · 426 阅读 · 0 评论 -
UVA 437 The Tower of Babylon
Perhaps you have heard of the legend of the Tower of Babylon. Nowadays many details of this tale have been forgotten. So now, in line with the educational nature of this contest, we will tell you the原创 2015-02-17 21:18:15 · 454 阅读 · 0 评论 -
UVA 10069 Distinct Subsequences
http://uva.onlinejudge.org/external/100/10069.pdf两个字符串,求下一个再上一个之中出现的次数。如果a[i] == b[j]则 dp[i][j] = dp[i-1][j] + dp[i-1][j-1]如果a[i] != b[j]则 dp[i][j] = dp[i-1][j]这里还涉及到高精度加法,是时候使用C语言的类了。原创 2015-02-17 21:34:53 · 370 阅读 · 0 评论 -
UVA 10534 Wavio Sequence
Wavio is a sequence of integers. It has some interesting properties.· Wavio is of odd length i.e. L = 2*n + 1.· The first (n+1) integers of Wavio sequence makes a strictly increasing sequence.原创 2015-02-17 21:42:55 · 428 阅读 · 0 评论 -
UVA 10051 Tower of Cubes
http://uva.onlinejudge.org/external/100/10051.pdfDIS变形,多了方向和路径。#include#include#include#include#includeusing namespace std;const int maxn = 505;int a[maxn][6], f[maxn][6], p[maxn][6][2], b[原创 2015-02-17 21:48:27 · 805 阅读 · 0 评论 -
UVA 111 History Grading
BackgroundMany problems in Computer Science involve maximizing some measure according to constraints.Consider a history exam in which students are asked to put several historical events into c原创 2015-02-17 15:43:21 · 334 阅读 · 0 评论 -
UVA 348 Optimal Array Multiplication Sequence
Given two arrays A and B, we can determine the array C = AB using the standard definition of matrix multiplication:The number of columns in the A array must be the same as the number of ro原创 2015-02-17 21:04:38 · 407 阅读 · 0 评论 -
UVA 624 CD
You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape N minutes long. How原创 2015-02-17 21:09:15 · 361 阅读 · 0 评论 -
HDU 1503 Advanced Fruits
Problem DescriptionThe company "21st Century Fruits" has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times this method doe原创 2015-04-29 20:53:08 · 429 阅读 · 0 评论 -
FZU 2186 小明的迷宫
Accept: 68 Submit: 496Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description小明误入迷宫,塞翁失马焉知非福,原来在迷宫中还藏着一些财宝,小明想获得所有的财宝并离开迷宫。因为小明还是学生,还有家庭作业要做,所以他想尽快获得所有财宝并离开迷宫。 Input原创 2015-03-22 15:50:11 · 1177 阅读 · 0 评论 -
HDU 1207 汉诺塔II
Problem Description经典的汉诺塔问题经常作为一个递归的经典例题存在。可能有人并不知道汉诺塔问题的典故。汉诺塔来源于印度传说的一个故事,上帝创造世界时作了三根金刚石柱子,在一根柱子上从下往上按大小顺序摞着64片黄金圆盘。上帝命令婆罗门把圆盘从下面开始按大小顺序重新摆放在另一根柱子上。并且规定,在小圆盘上不能放大圆盘,在三根柱子之间一回只能移动一个圆盘。有预言说,这件事完成时原创 2015-05-09 22:17:34 · 943 阅读 · 0 评论 -
HDU 3689 Infinite monkey theorem
Problem DescriptionCould you imaging a monkey writing computer programs? Surely monkeys are smart among animals. But their limited intelligence is no match for our human beings. However, there is原创 2015-05-03 10:21:17 · 512 阅读 · 0 评论 -
HDU 3341 Lost's revenge
Problem DescriptionLost and AekdyCoin are friends. They always play "number game"(A boring game based on number theory) together. We all know that AekdyCoin is the man called "nuclear weapon of FZ原创 2015-05-03 10:23:21 · 410 阅读 · 0 评论 -
ZOJ 3769 Diablo III
DescriptionDiablo III is an action role-playing video game. A few days ago, Reaper of Souls (ROS), the new expansion of Diablo III, has been released! On hearing the news, the crazy video game ner原创 2015-03-09 17:41:00 · 528 阅读 · 0 评论 -
CodeForces 225C Barcode
DescriptionYou've got an n × m pixel picture. Each pixel can be white or black. Your task is to change the colors of as few pixels as possible to obtain a barcode picture.A picture is a barcode原创 2015-02-19 17:14:31 · 711 阅读 · 0 评论 -
HDU 2602 Bone Collector
Font Size: ← →Problem DescriptionMany years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also h原创 2015-02-18 16:20:37 · 377 阅读 · 0 评论 -
CodeForces 213C Relay Race
DescriptionFurik and Rubik take part in a relay race. The race will be set up on a large square with the side of n meters. The given square is split into n × n cells (represented as unit squares原创 2015-02-19 17:24:29 · 696 阅读 · 0 评论 -
HDU 2546 饭卡
Problem Description电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负),否则无法购买(即使金额足够)。所以大家都希望尽量使卡上的余额最少。某天,食堂中有n种菜出售,每种菜可购买一次。已知每种菜的价格以及卡上的余额,问最少可使卡上的余额为多少。Inp原创 2015-02-18 16:28:05 · 369 阅读 · 0 评论 -
HDU 3449 Consumer
Problem DescriptionFJ is going to do some shopping, and before that, he needs some boxes to carry the different kinds of stuff he is going to buy. Each box is assigned to carry some specific kinds原创 2015-02-19 16:19:37 · 543 阅读 · 0 评论 -
ZOJ 2068 Chopsticks
DescriptionIn China, people use a pair of chopsticks to get food on the table, but Mr. L is a bit different. He uses a set of three chopsticks -- one pair, plus an EXTRA long chopstick to get some原创 2015-03-11 13:06:05 · 482 阅读 · 0 评论 -
HDU 3001 Travelling
Problem DescriptionAfter coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on seeing all the cities!And he does no原创 2015-02-19 16:43:50 · 453 阅读 · 0 评论 -
ZOJ 2319 Beatuiful People
DescriptionThe most prestigious sports club in one city has exactly N members. Each of its members is strong and beautiful. More precisely, i-th member of this club (members being numbered by the原创 2015-03-25 23:19:18 · 454 阅读 · 0 评论 -
CodeForces 118D Caesar's Legions
DescriptionGaius Julius Caesar, a famous general, loved to line up his soldiers. Overall the army had n1 footmen and n2 horsemen. Caesar thought that an arrangement is not beautiful if somewhere原创 2015-02-19 17:22:14 · 620 阅读 · 0 评论 -
HDU 2955 Robberies
Problem DescriptionThe aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided t原创 2015-02-18 16:24:52 · 419 阅读 · 0 评论 -
ZOJ 3703 Happy Programming Contest
DescriptionIn Zhejiang University Programming Contest, a team is called "couple team" if it consists of only two students loving each other. In the contest, the team will get a lovely balloon with原创 2015-03-10 19:01:54 · 531 阅读 · 0 评论 -
ZOJ 3211 Dream City
DescriptionJAVAMAN 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 ...and tree n. At the first day, each tree i has ai原创 2015-02-25 00:17:34 · 738 阅读 · 0 评论 -
CodeForces 166E Tetrahedron
DescriptionYou are given a tetrahedron. Let's mark its vertices with letters A, B, C and D correspondingly.An ant is standing in the vertex D of the tetrahedron. The ant is quite active and he原创 2015-02-19 17:18:48 · 569 阅读 · 0 评论 -
HDU 3247 Resource Archiver
Problem DescriptionGreat! Your new software is almost finished! The only thing left to do is archiving all your n resource files into a big one.Wait a minute… you realized that it isn’t as easy原创 2015-05-03 10:25:17 · 515 阅读 · 0 评论 -
HDU 2825 Wireless Password
Problem DescriptionLiyuan lives in a old apartment. One day, he suddenly found that there was a wireless network in the building. Liyuan did not know the password of the network, but he got some i原创 2015-05-03 10:22:35 · 473 阅读 · 0 评论 -
UVA 590 Always on the run
Screeching tires. Searching lights. Wailing sirens. Police cars everywhere. Trisha Quickfinger did it again! Stealing the `Mona Lisa' had been more difficult than planned, but being the world's best a原创 2015-02-17 21:50:59 · 384 阅读 · 0 评论