結果

問題 No.32 貯金箱の憂鬱
ユーザー oyafuso
提出日時 2019-03-11 15:15:20
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 1,073 bytes
コンパイル時間 2,685 ms
コンパイル使用メモリ 75,448 KB
実行使用メモリ 54,536 KB
最終ジャッジ日時 2024-07-23 07:29:31
合計ジャッジ時間 4,705 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

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