1 분 소요

1. 문제

[Bronze V] Bottle Return - 21300

문제 링크

성능 요약

메모리: 30860 KB, 시간: 68 ms

분류

사칙연산(arithmetic), 수학(math)

문제 설명

In the United States, beverage container deposit laws, or so-called bottle bills, are designed to reduce litter and reclaim bottles, cans and other containers for recycling. Ten states currently have some sort of deposit-refund systems in place for different types of beverage containers. These deposit amounts vary from 2¢ to 15¢ per container, depending on the type and volume of the container. For example, Oregon charges a (refundable) deposit of 2¢ per refillable container, and 10¢ for all others (with exceptions).

For this problem you will calculate the amount a customer will get refunded for a given collection of empty containers in the state of New York. New York’s rules are very simple: there is a 5¢ deposit for containers of any size less than one gallon containing beer, malt, wine products, carbonated soft drinks, seltzer and water (that does not contain sugar).

입력

Input consists of a single line containing 6 space separated integer values representing the number of empty containers of beer, malt, wine products, carbonated soft drinks, seltzer and water. Each value will be in the range [0, 100].

출력

The output consists of a single line that contains a single integer representing the total refund the customer should get in cents.

출처: 백준, https://https://www.acmicpc.net/

2. 해결방법 시간복잡도

  1. 단순 코딩 O(1)

3. 문제 해결 및 코드


  • 주석을 참고하면서 이해를 돕습니다.

4. 알고리즘 및 해설

  1. 문제에서 리필 가능한 용기당 2유로의 보증금을 준다고 했고, 다른 모든 용기에 대해서는 10유로를 보증금을 부과한다 했다.
  2. 하지만 1갤런 미만의 모든 용기에 대해서는 5유로의 보증금이 있다고 하였다.
    • 그러므로 모든 용기의 개수를 더한뒤 5를 곱해 출력해준다.