結果

問題 No.32 貯金箱の憂鬱
ユーザー tokustokus
提出日時 2021-11-19 22:17:35
言語 Java21
(openjdk 21)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 1,165 bytes
コンパイル時間 2,097 ms
コンパイル使用メモリ 72,364 KB
実行使用メモリ 49,828 KB
最終ジャッジ日時 2023-08-30 08:54:58
合計ジャッジ時間 3,649 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
49,156 KB
testcase_01 AC 46 ms
49,384 KB
testcase_02 AC 45 ms
49,260 KB
testcase_03 AC 46 ms
49,208 KB
testcase_04 AC 45 ms
49,164 KB
testcase_05 AC 46 ms
49,560 KB
testcase_06 AC 45 ms
49,652 KB
testcase_07 AC 46 ms
47,592 KB
testcase_08 AC 46 ms
49,828 KB
testcase_09 AC 46 ms
49,292 KB
testcase_10 AC 47 ms
49,228 KB
testcase_11 AC 46 ms
49,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.Arrays;
import java.util.stream.Stream;

class Main {
    public static void main(String[] args) {
        no32();
    }    
    
    // No.32 貯金箱の憂鬱
    private static void no32() {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        // 100円硬貨
        int $100;
        // 25円硬貨
        int $25;
        // 1円硬貨
        int $1;

        try {

            String L = reader.readLine();
            $100 = Integer.parseInt(L);
            String M = reader.readLine();
            $25 = Integer.parseInt(M);
            String N = reader.readLine();
            $1 = Integer.parseInt(N);

            reader.close();
        } catch (IOException e) {
            throw new UncheckedIOException(e);
        }

        int total = 0;

        total += $1 - 25 * ($1 / 25);
        $25 += $1 / 25;
        total += $25 - 4 * ($25 / 4);
        $100 += $25 / 4;
        total += $100 - 10 * ($100 / 10);

        System.out.println(total);
    }
}  
0