![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
动态规划-dp
Jerry Lee の blog
never never never give up.
展开
-
带记忆化搜索的斐波那契数列
带记忆化搜索的斐波那契数列//通过dp数组保留部分结果,动态规划避免大量重复性操作#include <cstdio>#include <iostream>#include <algorithm>using namespace std;const int MAXN=100;int dp[MAXN];int fabnaci(int n){ if(n==1 || n==2) {原创 2017-11-20 08:46:09 · 2413 阅读 · 0 评论 -
数塔问题
数塔问题输入558 312 7 164 10 11 69 5 3 9 4输出44//数塔问题,dp的递推形式//状态和状态转移方程,//分为边界,开始的地方就是边界#include <cstdio> #include <iostream>#include <algorithm>using namespace std;const int MAXN=1000;int f[M原创 2017-11-20 10:32:43 · 345 阅读 · 0 评论 -
LIS--最长不下降子序列
LIS–最长不下降子序列输入81 2 3 -9 3 9 0 11输出6#include <cstdio>#include <algorithm>using namespace std;const int N=100;int A[N],dp[N];int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++) {原创 2017-11-20 13:45:04 · 189 阅读 · 0 评论