
动态规划
文章平均质量分 80
akxxsb
写写博客装装逼,存代码
展开
-
最长公共上升子序列(LCIS)ZOJ 2432
立方算法:#include#include#include#include#define M 505using namespace std;typedef long long LL;LL a[M],b[M];int dp[M][M];int main(){ //freopen("in.txt","r",stdin); int T; cin>>T;原创 2014-07-20 22:35:05 · 1337 阅读 · 1 评论 -
dp FOJ 一月月赛C ytaaa
Accept: 57 Submit: 261Time Limit: 2000 mSec Memory Limit : 32768 KB Problem DescriptionYtaaa作为一名特工执行了无数困难的任务,这一次ytaaa收到命令,需要炸毁敌人的一个工厂,为此ytaaa需要制造一批炸弹以供使用。 Ytaaa使用的这种新型炸弹由若干个炸药组成,每个炸药都有原创 2014-11-16 17:31:15 · 1416 阅读 · 2 评论 -
Codeforces Round #302 (Div. 2) E. Remembering Strings(状压dp)
E. Remembering Stringstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have multiset of n strings of th原创 2015-05-08 20:20:50 · 1394 阅读 · 0 评论 -
Codeforces Round #301 (Div. 2)D (概率dp)
D. Bad Luck Islandtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Bad Luck Island is inhabited by thre原创 2015-05-06 13:24:12 · 780 阅读 · 0 评论 -
UVA1213 Sum of Different Primes(素数打表+dp)
UVA - 1213Sum of Different PrimesTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionA positive integer may be ex原创 2015-05-07 01:18:55 · 1485 阅读 · 0 评论 -
UVA 12063(dp记忆化)
UVA - 12063Zeros and OnesTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %lluSubmit StatusDescriptionBinary numbers and their pattern o原创 2015-05-07 01:07:49 · 1819 阅读 · 0 评论 -
Codeforces Round #302 (Div. 2)C (完全背包)
C. Writing Codetime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputProgrammers working on a large project have原创 2015-05-08 03:15:44 · 1089 阅读 · 0 评论 -
UVA 1638(动态规划)
有高为1到n的杆子各一根排成一行,从左往右能看见l根,从右往左能看见r根,问可能的方案数。dp[i][j][k]表示i根高度不同的杆子从左往右能看见j根,从右往左能看见k根,根据高度最低的那根杆子分类。#include #include #include #include using namespace std;typedef long long ll;const in原创 2015-05-08 21:32:23 · 1067 阅读 · 0 评论 -
动态规划部分题目小结
UVA10635 LCS转LIShttp://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=19053两个长度为p+1和q+1的序列A,B,序列中元素互不相同,且都是1到n^2的整数,求AB的LCS,将A中元素变为1到p+1,B中不在A中的元素直接删掉,问题转换为在B中求LIS复杂度nlogn。#include using namespa原创 2015-11-28 22:39:48 · 772 阅读 · 2 评论