背包问题(二)F903
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
Description
有一个背包容积为 V 和 n 个物品,并给出每个物品有一个体积。要求从 n 个物品中,任取若干个装入背包内,使背包的剩余空间为最小。
Input Format
第一行两个正整数 V 和 n,分别表示背包的容积和待装物品的个数;第二行包括 n 个正整数,表示 n 个物品的体积,两两之间有一个空格分隔。
Output Format
一个数,表示背包中剩余空间的最小值
24 6
8 3 12 7 9 7
0
Hint
数据范围:0< V ≤ 20000,0 < n ≤ 30
2025_07_07吉利学院暑假实训周-上机实践-7
- Status
- Done
- Rule
- XCPC
- Problem
- 12
- Start at
- 2025-7-7 14:00
- End at
- 2025-7-7 17:00
- Duration
- 3 hour(s)
- Host
- Partic.
- 27