Taking Out the Trash
시간 제한3초메모리 제한2048 MB
봉지 무게와 한 번에 들 수 있는 최대 무게가 주어질 때, 한 번에 한 봉지 또는 두 봉지를 옮겨 모든 쓰레기를 버리는 최소 횟수를 구한다.
문제
Peter has way too much trash and he needs to take it all out.
Specifically, there are bags of trash each with a specific weight. Peter can hold either one or two bags of trash per trip, and he can carry a maximum total of milligrams of trash in a single trip. What is the minimum number of trips Peter needs to take to take out all the trash?
입력
The input starts with two integers and , the number of bags of trash and the maximum weight of trash Peter can carry.
The next line contains integers, , the weight of each bag of trash in milligrams.
출력
Output the minimum number of trips Peter needs to make to take out all the trash.