
dp
文章平均质量分 82
974792789
不要在能吃苦的年纪追求安逸。
展开
-
Make Palindrome+uva+回文串dp
Problem AMake PalindromeInput: standard inputOutput: standard outputTime Limit: 8 seconds By definition palindrome is a string which is not changed when reversed. "MADAM" is a nice example原创 2014-10-26 12:32:26 · 428 阅读 · 0 评论 -
Anniversary party+hdu+树形dp+水之
Anniversary partyTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5303 Accepted Submission(s): 2447Problem DescriptionThere is原创 2014-11-15 20:40:04 · 513 阅读 · 0 评论 -
E. Fish+状态压缩dp+codeforces
E. Fishtime limit per test3 secondsmemory limit per test128 megabytesinputstandard inputoutputstandard outputn fish, numbered from 1 to n, live in a lake. Every day rig原创 2014-07-27 20:31:56 · 487 阅读 · 0 评论 -
炮兵阵地 POJ+状态压缩dp
炮兵阵地Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 18402 Accepted: 7099Description司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队。一个N*M的地图由N行M列组成,地图的每一格可能是山地(用"H" 表示),也可能原创 2014-07-24 20:00:11 · 464 阅读 · 0 评论 -
Homer Simpson+uva+01背包
Homer SimpsonTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluDescriptionReturn of the AztecsProblem C:Homer SimpsonTime L原创 2014-09-24 20:18:19 · 494 阅读 · 0 评论 -
Optimal Binary Search Tree+区间dp+uva
Problem EOptimal Binary Search TreeInput: standard inputOutput: standard outputTime Limit: 30 secondsMemory Limit: 32 MBGiven a set S = (e1, e2, ..., en) of n distinct elements such that e原创 2014-10-18 10:01:26 · 439 阅读 · 0 评论 -
Collecting Bugs+POJ 2096+概率期望dp
Collecting BugsTime Limit:10000MS Memory Limit:64000KB 64bit IO Format:%I64d & %I64uDescriptionIvan is fond of collecting. Unlike other people who collect post stamps, coins原创 2014-11-20 18:23:53 · 510 阅读 · 0 评论 -
Forming Quiz Teams+uva+状态压缩
4thIIUCInter-University Programming Contest, 2005GForming Quiz TeamsInput: standard inputOutput: standard outputProblemsetter: Sohel HafizYou ha原创 2014-11-11 12:23:07 · 521 阅读 · 0 评论 -
Strategic Game+hdu+树形dp
Strategic GameTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5148 Accepted Submission(s): 2368Problem DescriptionBob enjoy原创 2014-11-08 10:47:54 · 462 阅读 · 0 评论 -
Balancing Act+POJ+树形dp
Balancing ActTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9199 Accepted: 3826DescriptionConsider a tree T with N (1 <= N <= 20,000) nodes numbered 1.原创 2014-11-15 22:01:43 · 625 阅读 · 0 评论 -
Join the Conversation
#include #include#include#includeusing namespace std;char input[2000];char name[2000];char mention[2000];int dp[600000];int fa[600000];int path[600000];mapMax;mapkey;int main原创 2014-11-03 23:41:06 · 2141 阅读 · 0 评论 -
Stock Wave+csuoj+简单dp
Stock WaveTime Limit: 3 Sec Memory Limit: 128 MBSubmit: 45 Solved: 9[Submit][Status][Web Board]DescriptionAs a stock analyst, Tom can forecast the trend according to a series of hi原创 2014-10-05 15:44:36 · 436 阅读 · 0 评论 -
Distinct Subsequences+uva+经典dp
Distinct SubsequencesTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld & %lluDescriptionProblem EDistinct SubsequencesInput: standard inputOutput: stan原创 2014-09-30 12:30:37 · 453 阅读 · 0 评论 -
Edit Step Ladders+uva+简单dp
Problem C: Edit Step LaddersAn edit step is a transformation from one word x to another word y such that x and y are words in the dictionary, and x can be transformed to y by adding, del原创 2014-10-28 10:05:10 · 593 阅读 · 0 评论 -
Always on the run+uva+DAG图上的dp
Always on the runTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluDescription Always on the run Screeching tires.原创 2014-10-10 10:02:17 · 566 阅读 · 0 评论 -
Wavio Sequence +uva+最长升子序列dp(n*log(n))
Problem DWavio Sequence Input: Standard InputOutput: Standard OutputTime Limit: 2 Seconds Wavio is a sequence of integers. It has some interesting properties.· Wavio is of odd length i.原创 2014-10-01 20:50:15 · 516 阅读 · 0 评论 -
e-Coins+uva+分硬币dp
e-CoinsTime Limit: 3000MSMemory Limit: Unknown64bit IO Format: %lld & %lluDescriptionProblem Ge-CoinsInput: standard inputOutput: standard outputTime Limit: 10原创 2014-10-11 11:01:31 · 417 阅读 · 0 评论 -
String to Palindrome+uva+回文串dp
Problem HString to PalindromeInput: Standard InputOutput: Standard OutputTime Limit: 1 Second In this problem you are asked to convert a string into a palindrome with minimum number of ope原创 2014-10-11 20:22:24 · 463 阅读 · 0 评论 -
Paths through the Hourglass+uva+dp
Paths through the HourglassInput: Standard InputOutput: Standard OutputTime Limit: 2 SecondsIn the hourglass to the right a path is marked. A path always starts at the first row and ends at原创 2014-11-15 11:06:32 · 478 阅读 · 0 评论 -
Pay the Price+uva+dp
Pay the PriceInput: standard inputOutput: standard outputTime Limit: 2 secondsMemory Limit: 32 MB In ancient days there was a country whose people had very interesting habits. Some of them原创 2014-11-01 15:10:15 · 718 阅读 · 0 评论 -
Pebble Solitaire+uva+状态压缩+记忆化搜索
Pebble SolitaireTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluDescriptionProblem APebble SolitaireInput: standard inputOutput: standard o原创 2014-10-06 14:32:19 · 532 阅读 · 0 评论 -
Party at Hali-Bula+hdu+经典树形dp
Party at Hali-BulaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1890 Accepted Submission(s): 657Problem DescriptionDear Con原创 2014-09-30 23:09:44 · 607 阅读 · 0 评论 -
Triangle Counting+uva+数学题
Problem GTriangle CountingInput: Standard InputOutput: Standard Output You are given n rods of length 1, 2…, n. You have to pick any 3 of them & build a triangle. How many distinct triangl原创 2014-12-29 22:27:16 · 676 阅读 · 0 评论 -
Buying Coke +uva+记忆化搜索
Problem DBuying Coke Input: Standard InputOutput: Standard OutputTime Limit: 2 SecondsI often buy Coca-Cola from the vending machine at work. Usually I buy several cokes at once, since my wo原创 2014-12-12 22:19:21 · 625 阅读 · 0 评论 -
A Simple Problem with Integers+poj+splay树区间操作
A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 66557 Accepted: 20467Case Time Limit: 2000MSDescriptionYou have N i原创 2014-12-12 23:03:18 · 482 阅读 · 0 评论 -
Codeforces Round #286 (Div. 2) C. Mr. Kitayuta, the Treasure Hunter+dp+优化
从后往前dp,必须优化维度原创 2015-01-22 10:32:07 · 812 阅读 · 0 评论 -
uva607 Scheduling Lectures+uva+dp
uva 607 Scheduling Lectures解决方案:dp思路:dp[i]代表上了前面i个topic用的课时最少数,D[i]代表上了前面i个topic的最低不满意度; dp状态转移:dp[i]=min(dp[i],dp[j-1]+1),j>=1&&jcode:#include #include#includeusing namespac原创 2015-03-03 10:06:20 · 483 阅读 · 0 评论 -
uva 10118 Free Candies+记忆化搜索
uva 10118 Free Candies解决方案:dp思路为:dp[a1][a2][a3][a4]表示当取四堆的a1、a2、a3、a4之后最多获得多少对糖,由于只有20种糖,可以开一个20大的数组表示当前篮子中的存在不存在这种糖(只存不同的糖,相同的收回口袋),用cnt来记录篮子中的糖的个数,若cnt==5,且没有相同的糖,则dp[a1][a2][a3][a4]=0,表示当前状态无法再取,原创 2015-03-02 22:50:49 · 582 阅读 · 0 评论 -
uva 10604 Chemical Reaction 记忆化搜索
uva 10604 Chemical Reaction解决方案:dp思路:记忆化搜索,这题只有六种化学药品,可以开一个六维的数组进行dp,dp[a1][a2][a3][a4][a5][a6],a1...a6分别表示这六种药品剩余多少,然后选两种药品进化学反应(可以使同样类型的药品),进入下一状态进行搜索,每个状态由下一状态决定其最优值。code:#include #include#in原创 2015-03-03 10:12:01 · 562 阅读 · 0 评论 -
uva 11008 Antimatter Ray Clearcutting 状态压缩+记忆化搜索
uva 11008 Antimatter Ray Clearcutting dp思路:由于只有16棵树,所以可先预处理出可以一刀切的树的集合,stay_aline[i][j]沿着ij数切,所切的树的集合,可用一个32位大的数来表示,最低位是第0棵树,0表示不再这个集合中,1表示在,然后在用上三点共线的公式就可以处理出来了。记忆化搜索也是应用上了状态压缩,每次选两棵不同的数来切,除掉能切掉的数,原创 2015-03-03 12:29:31 · 588 阅读 · 0 评论 -
Codeforces Round #105 (Div. 2)--E. Porcelain 01背包
E. Porcelaintime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring her tantrums the princess usually smash原创 2015-01-26 21:30:37 · 672 阅读 · 0 评论 -
Codeforces Round #105 (Div. 2)—Bag of mice 概率期望dp
D. Bag of micetime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe dragon and the princess are arguing abou原创 2015-01-26 21:03:40 · 390 阅读 · 0 评论 -
LOOPS+hdu+简单概率期望dp
LOOPSTime Limit: 15000/5000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 2662 Accepted Submission(s): 1100Problem DescriptionAkemi Homura is a Maho原创 2014-11-23 15:56:57 · 496 阅读 · 0 评论 -
Contest+hdu+状态压缩dp
ContestTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0Problem Description In the ACM Internatio原创 2014-09-27 20:16:37 · 417 阅读 · 0 评论 -
Corn Fields +POJ+dp+状态压缩
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 7056 Accepted: 3754DescriptionFarmer John has purchased a lush new rectangular pasture compos原创 2014-07-24 18:31:51 · 421 阅读 · 0 评论 -
CD+uva+01背包(输出方案)
CDTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluDescription CD You have a long drive by car ahead. You have a tape原创 2014-09-23 11:04:21 · 1650 阅读 · 0 评论 -
Dividing coins+uva+01背包
Dividing coinsTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluDescription Dividing coins It's commonly known tha原创 2014-09-17 22:40:45 · 433 阅读 · 0 评论 -
Big Event in HDU+完全背包问题
Big Event in HDUTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23526 Accepted Submission(s): 8297Problem DescriptionNowaday原创 2014-08-16 10:36:34 · 433 阅读 · 0 评论 -
Chopsticks+uva+一般dp
Problem CChopsticksInput: Standard InputOutput: Standard OutputIn 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 ch原创 2014-10-19 08:50:24 · 409 阅读 · 0 评论 -
Again Palindromes+uva+回文串dp
Problem IAgain PalindromesInput: Standard InputOutput: Standard OutputTime Limit: 2 Seconds A palindorme is a sequence of one or more characters that reads the same from the left as it doe原创 2014-10-21 12:02:37 · 492 阅读 · 0 评论