結果

問題 No.32 貯金箱の憂鬱
ユーザー show258show258
提出日時 2017-03-30 18:38:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 812 bytes
コンパイル時間 4,919 ms
コンパイル使用メモリ 72,032 KB
実行使用メモリ 56,256 KB
最終ジャッジ日時 2023-09-30 10:06:45
合計ジャッジ時間 7,540 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
56,256 KB
testcase_01 AC 128 ms
55,864 KB
testcase_02 AC 130 ms
55,720 KB
testcase_03 AC 128 ms
53,796 KB
testcase_04 AC 130 ms
56,008 KB
testcase_05 AC 130 ms
55,568 KB
testcase_06 AC 132 ms
55,836 KB
testcase_07 AC 131 ms
56,004 KB
testcase_08 AC 133 ms
55,572 KB
testcase_09 AC 132 ms
55,428 KB
testcase_10 AC 130 ms
55,648 KB
testcase_11 AC 131 ms
56,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No32 {
    public static void main(String[] args) {
        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);

        // int 100円硬貨の個数
        int l = sc.nextInt();

        // int 25円硬貨の個数
        int m = sc.nextInt();

        // int 1円硬貨の個数
        int n = sc.nextInt();

        sc.close(); // 標準入力をクローズ

        // 1円硬貨25枚を25円硬貨に交換する
        m = m + (n / 25);
        n = n % 25;

        // 25円硬貨4枚を100円硬貨に交換する
        l = l + (m / 4);
        m = m % 4;

        // 100円硬貨10枚を1000円札に交換する
        l = l % 10;

        System.out.println( l + m + n );

    }
}
0