随笔分类 - DP
摘要:1 int dp[11][11]; 2 int a[11]; 3 4 class Solution { 5 public: 6 long long dfs(int eq,int dep,int sum) 7 { 8 if(!dep)return sum; 9 if(~dp[dep][sum]&&!e
阅读全文
摘要:洛谷 P6218 [USACO06NOV] Round Numbers S 1 #include<bits/stdc++.h> 2 using namespace std; 3 //dp[dep][cnt1][cnt0];//表示1-n中考虑到dep位,1的个数为cnt1个,0的个数为cnt0个,的
阅读全文
摘要:洛谷P4127 [AHOI2009]同类分布 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 ll dp[20][163][163];//表示余数和为md,考虑到dep位第dep位还未选,数位和为s
阅读全文