In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "how to understand the backpack problem," interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how to understand the backpack problem"!
0-1 Two-dimensional bc of knapsack problem
#include #include #include using namespace std;const int N=1010;int n,m;int v[N],w[N];int f[N][N]; //valency sum int main(){ cin>>n>>m; for(int i=1;i>v[i]>>w[i]; //When 0 items are selected, the sum of values is 0, i.e. f[0][0~m] = 0; //Since it has been defined as a global variable, it has been initialized to 0, so it can not be written. for(int i=1;iv[i]>>w[i]; for(int i=1;i=v[i];j--) f[j]=max(f[j],f[j-v[i]]+w[i]); cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.