Melons
시간 제한1초메모리 제한1024 MB
각 시작 위치 x에 대해 무게 합이 L을 넘지 않도록 멜론을 순서대로 상자에 담을 때, 상자 개수와 마지막 상자의 무게를 구한다.
문제
In EGOI Farm, the employees are receiving and shipping melons. This morning, melons are received. The melons are numbered from to . The weight of melon () is .
Rie is working at EGOI Farm. Her job is packing melons into boxes. Now, an integer () is determined in EGOI Farm. After that, she will receive the melons , in this order. She will pack them into boxes by repeating the following process.
- Rie will take an empty box. She will repeat putting the melons into the box. However, if the total weight of the melons in the box will exceeds after putting the next melon into the box, she will not put it into the box. Then, she will ship the box. (In this case, she will put the next melon into a new box.)
After putting the melon into a box, she will ship the box, and her job will be finished.
Rie wants to prepare for her job for all possible values of . Write a program which, given information of the melons and the maximum possible weight of a box, calculates the number of boxes shipped by her and the total weight of the melons in the last box for all possible values of .
입력
Read the following data from the standard input. Given values are all integers.
출력
Write lines to the standard output. The -th line () of output corresponds to the case . This line should contain the number of shipped boxes and the total weight of the melons in the last box if . These two values should be separated by a space.
제한
- .
- .
- ().