随笔分类 -  dp

dp:最长非递减序列
摘要:This state carries only data about the length of this sequence. Note that for i<j the state i is independent from j, i.e. doesn’t change when we calcu 阅读全文

posted @ 2019-11-20 15:50 ewitt 阅读(119) 评论(0) 推荐(0)

dp:找零问题
摘要:C代表币的种类,n代表钱数 #include<iostream> using namespace std; #define C 4 void main( ) { int coin[4]={1,3,5,10}; int i,j,n=20,dp[20]={0}; for(i=1;i<20;i++) dp[i]=100; for(i=1;i<=n;i++) { for(j=0;j<C;j++) if(i 阅读全文

posted @ 2019-11-20 15:20 ewitt 阅读(203) 评论(0) 推荐(0)

导航