問題一覧 > 通常問題

No.32 The Melancholy of the Piggy Bank

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 1506
作問者 : なお
お気に入りにしたユーザー ProblemId : 5 / 自分の提出
問題文最終更新日: 2018-09-16 20:56:28
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 32 (順位表) の他の問題:

Problem Statement

Taro always saves his small change, putting his coins into a piggy bank.
Since the contents of the piggy bank have built up to some extent,
Taro has decided to go to the bank and have them exchanged.

The currency of Taro's country consists of \(1000\)-yen bills and coins of \(100\) yen, \(25\) yen, and \(1\) yen.
There are no bills or coins of any other denomination.

Exchanges are as follows:
・\(25\) coins of \(1\) yen into \(1\) coin of \(25\) yen
・\(4\) coins of \(25\) yen into \(1\) coin of \(100\) yen
・\(10\) coins of \(100\) yen into \(1\) \(1000\)-yen bill
Each of these exchanges can be made.

The input gives the number of each type of coin in the piggy bank.
When exchanging so that the number of coins left on hand is minimized,
output the total number of coins Taro has in the end.

Exchanges can be made any number of times with no fee.
Also, the total amount of money must not change before and after an exchange.

Input

L
M
N

Line \(1\) contains an integer \( L (0 \leq L \leq 1000) \), the number of \(100\)-yen coins.
Line \(2\) contains an integer \( M (0 \leq M \leq 1000) \), the number of \(25\)-yen coins.
Line \(3\) contains an integer \( N (0 \leq N \leq 1000) \), the number of \(1\)-yen coins.

Output

Output the total number of coins.
Print a newline at the end.

Sample

Sample 1
Input
7
20
10
Output
12

Exchanging the \(25\)-yen coins, \(20\) of them, into \(100\)-yen coins, \(5\) of them, and then exchanging \(100\)-yen coins, \(10\) of them, into a \(1000\)-yen bill
gives the minimum.

Sample 2
Input
0
0
0
Output
0

The piggy bank was empty.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。