結果

問題 No.32 貯金箱の憂鬱
ユーザー eagleeagle
提出日時 2022-05-26 14:37:49
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 2,145 ms
コンパイル使用メモリ 74,472 KB
実行使用メモリ 57,684 KB
最終ジャッジ日時 2023-10-20 19:26:45
合計ジャッジ時間 4,582 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
57,424 KB
testcase_01 AC 110 ms
56,256 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		//100円硬貨の枚数
		int L = sc.nextInt();
		//25円硬貨の枚数
		int M = sc.nextInt();
		//1円硬貨の枚数
		int N = sc.nextInt();
		//1円硬貨を両替
		if(N != 0) {
			M += 25 / N;
			N = 25 % N;
		}
		//25円硬貨を両替
		if(M != 0) {
			L += 4 / M;
			M = 4 % M;
		}
		//100円硬貨を両替
		if(L != 0) {
			L = 10 % L;
		}
		//硬貨の合計枚数を求める
		int sum = N + M + L;
		System.out.println(sum);
	}
}
0