![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
背包九讲
zytzyt198
C 学习中
展开
-
完全背包问题实例 acwing 1055
acwing 1055 股票买卖II#include<iostream>#include<cmath>#include<cstring>using namespace std;typedef long long ll;int main(){ ll f[2][100010]; int n; memset( f, 0xcf, sizeof(f)); cin >> n; ll x; f[0][0] =原创 2020-09-20 00:04:17 · 84 阅读 · 0 评论 -
01背包问题 acwing 2
acwing 2 01背包问题#include<iostream>#include<algorithm>#include<cstring>using namespace std;int v[1010] , w[1010];int f[1010];int main(){ memset(f,0x8f,sizeof(f));//初始化为负无穷, f[0] = 0 ;//加10,11行后 求体积刚好为m时的最高价值 int n , m ; cin &原创 2020-09-20 00:01:15 · 88 阅读 · 0 评论 -
01背包问题实例acwing 1054
acwing 1054股票买卖#include<iostream>#include<algorithm>#include<cstring>#include<cmath>using namespace std;typedef long long ll;int main(){ int n; ll minn; ll maxn = 0; ll x; cin >> n; n--; c原创 2020-09-19 23:52:45 · 89 阅读 · 0 评论