02 2021 档案

摘要:与01背包结合的: #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn][maxn]; int main(){ int n,V,M;cin>>n>>V>>M; for(int i=1;i<=n; 阅读全文
posted @ 2021-02-04 20:03 Anonytt 阅读(32) 评论(0) 推荐(0)
摘要:不优化朴素解法,01背包看出S=1,完全背包看成S=INF,再跑多重背包(时间复杂度高,3层for循环): #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn]; int v[maxn],w[m 阅读全文
posted @ 2021-02-04 19:28 Anonytt 阅读(60) 评论(0) 推荐(0)
摘要:朴素版本: #include<bits/stdc++.h> using namespace std; const int maxn=1005; int dp[maxn][maxn]; int v[maxn][maxn],w[maxn][maxn],s[maxn]; int main(){ int n 阅读全文
posted @ 2021-02-03 20:46 Anonytt 阅读(70) 评论(0) 推荐(0)
摘要:朴素无优化版本: #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn][maxn]; int v[maxn],w[maxn],s[maxn]; int main(){ int n,m;scanf 阅读全文
posted @ 2021-02-03 19:14 Anonytt 阅读(52) 评论(0) 推荐(0)
摘要:暴力朴素无优化写法(3维for+2维数组): #include<bits/stdc++.h> using namespace std; const int maxn=1e3+5; int dp[maxn][maxn]; int v[maxn],w[maxn]; int main(){ int n,m 阅读全文
posted @ 2021-02-03 18:14 Anonytt 阅读(73) 评论(0) 推荐(0)