Logo
(追記) (追記ここまで)

24577번 - Espresso! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB25513612655.022%

문제

John is a student working as a part-time barista at the micro kitchen of his school department. He operates the espresso machine at the kitchen to make espresso and latte for students seeking energy to study.

Today, there are n students coming to the micro kitchen to place an order. An order is noted with an espresso shot number x ranging between 1 and 4, and an optional letter L that indicates that the student wants to have a x-shot latte. For example, an order 2 means a 2-shot espresso, and an order 3L means a 3-shot latte.

Making an x-shot espresso consumes x ounces of water. Making a latte requires steaming milk and consumes one additional ounce of water, e.g. making a 3-shot latte consumes 4 ounces of water. The espresso machine at the micro kitchen has a water tank of s ounces that is full at the beginning of the day. John refills the water tank to s ounces whenever the remaining water in the tank is not enough to fulfill the next student’s order. John fulfills the n orders one by one without changing their order.

How many times do John have to refill the water tank today in order to serve all the n students?

입력

The first line of input has two integers n (1 ≤ n ≤ 100) and s (10 ≤ s ≤ 200). The next n lines each contain a digit between 1 and 4 followed by an optional letter L to describe an order. The orders are to be fulfilled in the given order as they appear in the input.

출력

Output the number of times John has to refill the water tank of the espresso machine.

제한

예제 입력 1

8 10
1
2L
3
4
3L
1
1L
4L

예제 출력 1

2

예제 입력 2

3 12
4
4
4

예제 출력 2

0

힌트

출처

ICPC > Regionals > North America > Mid-Atlantic Regional > 2021 Mid-Atlantic USA Regional Contest A번

ICPC > Regionals > North America > North Central North America Regional > 2021 North Central NA Regional Contest L번

  • 문제를 만든 사람: Bowen Yu
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /