装箱问题

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.

题目描述

有一个箱子容量为 v(正整数,0≤v≤20000),同时有 n 个物品(0<n≤30),每个物品有一个体积(正整数)。 要求从 n 个物品中,任取若干个装入箱内,使箱子的剩余空间为最小。

输入格式

箱子的容量 v 物品数 n 接下来 n 行,分别表示这 n 个物品的体积

输出格式

箱子剩余空间

样例

输入 #1复制

24 
6 
8 
3 
12 
7 
9 
7

输出 #1复制

0 

动态规划

Not Claimed
Status
Done
Problem
18
Open Since
2024-12-19 0:00
Deadline
2025-3-22 23:59
Extension
24 hour(s)