入门题
A set of n 1-dimensional items have to be packed in identical bins. All bins have exactly the same length l and each item i has length li<=l . We look for a minimal number of bins q such that
each bin contains at most 2 items,
each item is packed in one of the q bins,
the sum of the lengths of the items packed in a bin does not exceed l .
You are requested, given the integer values n , l , l1 , …, ln , to compute the optimal number of bins q .
题意:
有n个东西,每个东西都有自己的长度,给定箱子的长度,一个箱子里最多装两个东西,
箱子里东西的总长度不能超过箱子的长度,要求是求出箱子最少有几个。
input:
第一行给出n代表有几个东西
第二行给出箱子的长度
接下来n行给出每个东西的长度
output:
输出箱子最少的个数
ll t,