Diet Plan

면접 대비

시간 제한1초메모리 제한2048 MB

요약
매일 P_i mL의 우유나 비스킷 하나가 필요하다. 우유 M mL와 비스킷 K개로 며칠까지 식단을 유지할 수 있는지 구한다.
난이도

보통10점 중 5점

유형
그리디, 정렬, 누적 합, 구현
정답자
아직 제출이 없습니다

문제

You have a diet plan for the next NN days (numbered from 11 to NN). During day ii, you need to drink exactly P_iP\_i mL of milk. Alternatively, you can consume a biscuit instead, as a replacement for milk on that day.

Currently, you only have MM mL of milk and KK 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 NN MM KK (1≤N≤1001 ≤ N ≤ 100; 0≤M,K≤1000 ≤ M, K ≤ 100).

The next line consists of NN integers P_iP\_i (1≤P_i≤1001 ≤ P\_i ≤ 100).

출력

Output a single integer representing the maximum number of days you can maintain your diet plan.

예제4

  1. 예제 1

    입력
    7 100 2
    70 30 20 40 50 40 10
    
    예상 출력
    5
    
  2. 예제 2

    입력
    7 70 1
    70 30 40 20 50 10 60
    
    예상 출력
    3
    
  3. 예제 3

    입력
    7 0 100
    100 100 100 100 100 100 100
    
    예상 출력
    7
    
  4. 예제 4

    입력
    7 0 0
    1 1 1 1 1 1 1
    
    예상 출력
    0