
————动态规划————
文章平均质量分 50
tjx_belief
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
GCJ--Millionaire (2008 APAC local onsites C)
Problem You have been invited to the popular TV show “Would you like to be a millionaire?”.Of course you would! The rules of the show are simple: Before the game starts, the host spins a wheel of f原创 2017-02-18 09:30:50 · 560 阅读 · 1 评论 -
***POJ 3280 Cheapest Palindrome
原题链接思路: 动态规划,回文符。 dp[j][k]是从j到k变为回文符所需的最小花费。AC代码:#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #include <cmath> using namespace std;int N,M; char s[原创 2017-03-17 19:57:53 · 243 阅读 · 0 评论 -
POJ 3616 Milking Time
原文链接原题: Description Bessie 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 (conveniently labele原创 2017-03-17 19:40:33 · 212 阅读 · 0 评论 -
POJ 2385 Apple Catching
原题链接思路: 动态规划。 思路:i秒转移j次:dp[i][j] = max(dp[i-1][j],dp[i-1][j-1]) + 第i秒是否接到苹果 dp[i-1][j]: i秒没有转移 dp[i-1][j-1]:i秒转移了 AC代码:#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib原创 2017-03-17 19:33:56 · 226 阅读 · 0 评论 -
***SPOJ - GCJ1C09C Bribe the Prisoners【贿赂囚犯】
原题链接题目: n 组测试数据,有p个人在监狱,要放出q个人,这些人的编号为a[1]~a[q],每放出一个人,他周围的人(两边连续的直到碰到空的监狱或者尽头)都要贿赂1枚金币,问最少花费多少金币。原创 2017-02-18 21:13:56 · 656 阅读 · 0 评论 -
CodeForces - 711C Coloring Trees【给树染色】
Problem ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where n trees grow. They decided to be naughty and color the trees in the park. The trees are numbered with i原创 2017-02-18 15:21:01 · 446 阅读 · 0 评论 -
***POJ 3046 Ant Counting
原题链接思路: 首先弄清楚T,A,S,B的意思。 T是蚂蚁有多少种。 A是蚂蚁有多少个。 每组蚂蚁数在S~B之间。 output有多少组符合条件。 然后用动态规划。 dp[i][j]在第i种蚂蚁前,已经取了j种蚂蚁。 dp[i+1][j+k] = dp[i][j] + dp[i][j+1] + …… + dp[i][j+k] (已经从i种之前选了j~j+k只蚂蚁,要再选取k~0只第原创 2017-03-17 17:11:15 · 225 阅读 · 0 评论 -
POJ 3176 Cow Bowling
原题链接思路:动态规划。 动态方程:dp[i][j] = dp[i][j] + max(dp[i-1][j-1], dp[i-1][j]) dp[i][j]表示到点(i,j)的最大数字和。AC代码:#include <iostream>原创 2017-02-22 20:25:16 · 221 阅读 · 0 评论 -
POJ 1742 Coins
原题链接 Description People in Silverland use coins.They have coins of value A1,A2,A3…An Silverland dollar.One day Tony opened his money-box and found there were some coins.He decided to buy a very nice wa原创 2017-02-22 20:17:35 · 254 阅读 · 0 评论 -
***POJ 3180 Dollar Dayz【大数处理】
原题链接思路: 动态规划。大数处理。高位是dp/mod,低位是dp%mod。AC代码:#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #include <cmath> using namespace std;//思路:参考完全背包问题。 //因为数很大,原创 2017-03-17 20:16:09 · 231 阅读 · 0 评论