| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 141 | 78 | 59 | 50.862% |
You have a diet plan for the next $N$ days (numbered from $1$ to $N$). During day $i$, you need to drink exactly $P_i$ mL of milk. Alternatively, you can consume a biscuit instead, as a replacement for milk on that day.
Currently, you only have $M$ mL of milk and $K$ biscuits. If there is not enough milk to drink on a day and you run out of biscuits, then your diet plan stops.
Determine the maximum number of days you can maintain your diet plan.
The first line consists of three integers $N$ $M$ $K$ ($1 ≤ N ≤ 100$; $0 ≤ M, K ≤ 100$).
The next line consists of $N$ integers $P_i$ ($1 ≤ P_i ≤ 100$).
Output a single integer representing the maximum number of days you can maintain your diet plan.
7 100 2 70 30 20 40 50 40 10
5
You can consume a biscuit on day $1$ and $4$ to maintain your diet plan for $5$ days.
7 70 1 70 30 40 20 50 10 60
3
You can consume a biscuit on day $1$ to maintain your diet plan for $3$ days.
7 0 100 100 100 100 100 100 100 100
7
7 0 0 1 1 1 1 1 1 1
0
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2023 B번
ICPC > Regionals > Asia Pacific > Indonesia > Indonesia National Contest > INC 2024 연습 세션 PB번