随笔分类 -  动态规划(初级)

摘要:递归思路 超时算法#includeusing namespace std;#define Size 101int Triangle[Size][Size];int n;int GetAns( int i, int j ){ if( i==n ) return Tr... 阅读全文
posted @ 2015-07-21 20:16 _SunDaSheng 阅读(197) 评论(0) 推荐(0)
摘要:思路参考这里#include#include#includeusing namespace std;#define Size 1000int table[Size+1][Size+1];int main(){ string A, B; while( cin>>A>>B )... 阅读全文
posted @ 2015-07-14 21:12 _SunDaSheng 阅读(109) 评论(0) 推荐(0)
摘要:相比 HDOJ 的 fatmouse‘s speed 这道题只需要输出 最长子序列的长度#includeusing namespace std;#define Size 1000int main(){ int N1; int table[Size+1]; i... 阅读全文
posted @ 2015-07-08 20:38 _SunDaSheng 阅读(126) 评论(0) 推荐(0)
摘要:求递增子序列的最大和状态转移方程:table[i] = max(table[i]+value[j]) 前提value[i]>value[j], 构成递增】其中jfrom 0 to i-1 table[i]是前i个中的最优状态, value[j] 是 j 的价值#includeusing namesp... 阅读全文
posted @ 2015-07-08 15:58 _SunDaSheng 阅读(107) 评论(0) 推荐(0)
摘要:#include#include#include#include#include#includeusing namespace std;#define Size 1000struct Node{ int Weight, Speed; int index; b... 阅读全文
posted @ 2015-07-08 11:36 _SunDaSheng 阅读(139) 评论(0) 推荐(0)