結果

問題 No.32 貯金箱の憂鬱
ユーザー KSnitechKSnitech
提出日時 2017-10-17 15:45:57
言語 Java19
(openjdk 21)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 604 bytes
コンパイル時間 3,172 ms
コンパイル使用メモリ 71,720 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-09-30 12:43:30
合計ジャッジ時間 5,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,028 KB
testcase_01 AC 124 ms
55,820 KB
testcase_02 AC 124 ms
56,200 KB
testcase_03 AC 124 ms
56,068 KB
testcase_04 AC 123 ms
56,148 KB
testcase_05 AC 122 ms
55,584 KB
testcase_06 AC 124 ms
55,780 KB
testcase_07 AC 123 ms
55,884 KB
testcase_08 AC 123 ms
56,324 KB
testcase_09 AC 127 ms
56,200 KB
testcase_10 AC 124 ms
55,768 KB
testcase_11 AC 125 ms
56,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Coin {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int[] coins = new int[3];

        for (int i = 0; i < coins.length; i++) {
            coins[i] = stdIn.nextInt();
        }

        while (coins[2] >= 25) {
            coins[2] -= 25;
            coins[1]++;
        }

        while (coins[1] >= 4) {
            coins[1] -= 4;
            coins[0]++;
        }

        while (coins[0] >= 10) {
            coins[0]-=10;
        }

        System.out.println(coins[0] + coins[1] + coins[2]);

    }
}
0