Toggle navigation
linghang
F.A.Qs
Web Board
ProblemSet
Source/Category
Status
Ranklist
Contest
[
ProblemSet
Status
Ranklist
OI Ranklist
Statistics
]
Login
Problem B: 装箱问题(boxes)
Problem B: 装箱问题(boxes)
Time Limit:
1
Sec
Memory Limit:
128 MB
Submit:
90
Solved:
15
[
Submit
] [
Status
] [
Web Board
] [Creator:
]
Description
有一个箱子容量为 v(正整数,0≤v≤20000),同时有 n 个物品(0<n≤30),每个物品有一个体积(正整数)。
要求从 n 个物品中,任取若干个装入箱内,使箱子的剩余空间为最小。
Input
箱子的容量 v
物品数 n
接下来 n 行,分别表示这 n 个物品的体积
Output
箱子剩余空间
Sample Input
Copy
24 6 8 3 12 7 9 7
Sample Output
Copy
0