結果

問題 No.32 貯金箱の憂鬱
ユーザー oyafusooyafuso
提出日時 2019-03-11 15:15:20
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 1,073 bytes
コンパイル時間 2,552 ms
コンパイル使用メモリ 73,088 KB
実行使用メモリ 56,704 KB
最終ジャッジ日時 2023-09-30 13:27:34
合計ジャッジ時間 4,577 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,008 KB
testcase_01 AC 121 ms
56,332 KB
testcase_02 AC 122 ms
56,152 KB
testcase_03 AC 120 ms
54,344 KB
testcase_04 AC 121 ms
55,952 KB
testcase_05 AC 120 ms
56,128 KB
testcase_06 AC 126 ms
55,528 KB
testcase_07 AC 122 ms
55,896 KB
testcase_08 AC 119 ms
56,248 KB
testcase_09 AC 119 ms
56,704 KB
testcase_10 AC 120 ms
56,104 KB
testcase_11 AC 119 ms
56,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {

	private static final String SPLIT_STR = " ";
	private static final int AMOUNT_X = 1000;
	private static final int AMOUNT_L = 100;
	private static final int AMOUNT_M = 25;
	private static final int AMOUNT_N = 1;

	public static void main(String[] args) {
		// Scanner生成
		Scanner sc = new Scanner(System.in);
		// 入力設定
		String input = null;
		List<Integer> numList = new ArrayList<>();
		for (int i = 0; i < 3; i++) {
			sc.reset();
			input = sc.nextLine();
			numList.add(Integer.parseInt(input));
		}
		// Scannerクローズ
		sc.close();

		/* メイン処理開始 */
		// 変数初期化
		int result = 0;
		int L = numList.get(0);
		int M = numList.get(1);
		int N = numList.get(2);
		int amount = 0;
		// 結果設定
		amount = AMOUNT_L * L + AMOUNT_M * M + AMOUNT_N * N;
		amount %= AMOUNT_X;
		result += amount / AMOUNT_L;
		amount %= AMOUNT_L;
		result += amount / AMOUNT_M;
		amount %= AMOUNT_M;
		result += amount / AMOUNT_N;
		/* メイン処理終了 */

		// 結果出力
		System.out.println(result);
	}
}
0