結果

問題 No.32 貯金箱の憂鬱
ユーザー YamaKasaYamaKasa
提出日時 2018-04-19 15:40:57
言語 Java19
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 789 bytes
コンパイル時間 1,995 ms
コンパイル使用メモリ 71,444 KB
実行使用メモリ 56,320 KB
最終ジャッジ日時 2023-09-30 13:09:57
合計ジャッジ時間 4,383 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,876 KB
testcase_01 AC 125 ms
55,584 KB
testcase_02 AC 125 ms
55,936 KB
testcase_03 AC 125 ms
56,320 KB
testcase_04 AC 125 ms
56,076 KB
testcase_05 AC 125 ms
55,800 KB
testcase_06 AC 124 ms
55,576 KB
testcase_07 AC 124 ms
55,580 KB
testcase_08 AC 125 ms
56,040 KB
testcase_09 AC 127 ms
56,004 KB
testcase_10 AC 125 ms
55,844 KB
testcase_11 AC 125 ms
55,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		//System.out.println("100円硬貨の枚数");
		int L = scanner.nextInt();
		//System.out.println("25円硬貨の枚数");
		int M = scanner.nextInt();
		//System.out.println("1円硬貨の枚数");
		int N = scanner.nextInt();
		scanner.close();
		int a = 100;
		int b = 25;
		int c = 1000;
		int sum = L*a+M*b+N; //貯金箱の金額
		int k = 0;			 //お札の枚数
		int l, m, n = 0;
		k = sum / c;
		int coin_sum = 0;	 //硬貨の金額の合計
		coin_sum = sum - k*c;
		l = coin_sum / a;
		coin_sum = coin_sum - a*l;
		m = coin_sum / b;
		coin_sum = coin_sum - b*m;
		n = coin_sum;
		int num_coin = l + m + n;
		System.out.println(num_coin);
	}
}
0