結果

問題 No.32 貯金箱の憂鬱
ユーザー yuuki121yuuki121
提出日時 2020-12-21 23:13:53
言語 Java
(openjdk 23)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 650 bytes
コンパイル時間 2,896 ms
コンパイル使用メモリ 73,044 KB
実行使用メモリ 37,168 KB
最終ジャッジ日時 2024-09-21 13:13:17
合計ジャッジ時間 4,291 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int a = Integer.parseInt(br.readLine()); // 100
		int b = Integer.parseInt(br.readLine()); //  25
		int c = Integer.parseInt(br.readLine()); //   1

		int c2 = c / 25;
		if (c2 > 0) {
			b = b + c2;
			c = c - c2 * 25;
		}

		int b2 = b / 4;
		if (b2 > 0) {
			a = a + b2;
			b = b - b2 * 4;
		}

		int a2 = a / 10;
		if (a2 > 0) {
			a = a - a2 * 10;
		}

		System.out.println(a + b + c);

	}

}
0