시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 1024 MB | 41 | 14 | 11 | 40.741% |
A class of n music students are going to rehearse for a concert in a recital hall. In one rehearsal pass, each student will give one performance in order from student 1 to student n. Student i’s performance has a duration of di. After the last student’s performance concludes, a new rehearsal pass will start immediately, beginning with the performance of student 1.
On each day, the recital hall will be open for a fixed duration of p. At any moment if the next student’s performance cannot complete before the recital hall closes, all the remaining performances within the current rehearsal pass will be moved to the next day.
In k days, how many full rehearsal passes can the class complete?
The first line of input contains three integers n, p, k (1 ≤ n ≤ 2 · 105, 1 ≤ p, k ≤ 109). Each of the next n lines contains a single integer. The ith line gives di (1 ≤ di ≤ p).
Output the number of full rehearsal passes the class can complete in k days.
3 9 5 1 2 3
7
4 10 5 3 2 4 6
2
3 10 2 5 6 7
0
ICPC > Regionals > North America > Mid-Atlantic Regional > 2021 Mid-Atlantic USA Regional Contest C번
ICPC > Regionals > North America > North Central North America Regional > 2021 North Central NA Regional Contest M번