首页 > Knapsack Problem
头像 采蜜中
发表于 2021-04-18 20:53:12
遍历求和 #include <iostream> using namespace std; int main() { int T; cin >> T; while (T--) { int n, w, c; ci 展开全文
头像 天元之弈
发表于 2022-01-15 09:32:20
传送门->https://ac.nowcoder.com/acm/problem/13882 题意翻译 题目描述 今天,HH 成为一名购物者,他想买很多东西。 HH有一个包最多可以装w公斤的东西,他有d美元。 现在他想买 n 件物品,第 i件物品重量 w i公斤,花费 c i美元。 H他不擅长 展开全文
头像 想润的菠萝蜜在备战秋招
发表于 2022-07-03 17:54:49
题目意思就是判断总的wi的和,总的ci和,然后判断是否小于题目给出的w,d就可以了。注意每次循环要用的变量位置要设置正确。 ">#include<string> using namespace std; int main() { int t,n,w,d; int count=0; 展开全文

等你来战

查看全部