結果

問題 No.32 貯金箱の憂鬱
ユーザー bigbear90560bigbear90560
提出日時 2015-07-03 00:36:57
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 5,000 ms
コード長 984 bytes
コンパイル時間 3,380 ms
コンパイル使用メモリ 72,136 KB
実行使用メモリ 56,236 KB
最終ジャッジ日時 2023-09-30 07:51:42
合計ジャッジ時間 5,715 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,692 KB
testcase_01 AC 127 ms
55,456 KB
testcase_02 AC 129 ms
55,872 KB
testcase_03 AC 127 ms
55,828 KB
testcase_04 AC 129 ms
55,788 KB
testcase_05 AC 129 ms
55,548 KB
testcase_06 AC 133 ms
56,020 KB
testcase_07 AC 131 ms
55,752 KB
testcase_08 AC 130 ms
56,236 KB
testcase_09 AC 129 ms
55,772 KB
testcase_10 AC 130 ms
55,932 KB
testcase_11 AC 126 ms
55,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

/**
 * No.32 貯金箱の憂鬱
 */
public class MelancholyOfPiggyBank {

	public static void main(String[] args) {

        // 標準入力から読み込む際に、Scannerオブジェクトを使う。
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();	// 100円
        int b = sc.nextInt();	//  25円
        int c = sc.nextInt();	//   1円

        int upCoinNum = 0;
        int restCoinNum = 0;
        int sumCoinNum = 0;
        
        if (0 != c) {
        	upCoinNum = (int)Math.floor(c / 25);
        	restCoinNum = c % 25;
        	b += upCoinNum;
        	sumCoinNum += restCoinNum; 
        }
        if (0 != b) {
        	upCoinNum = (int)Math.floor((b)/ 4);
        	restCoinNum = b % 4;
        	a += upCoinNum;
        	sumCoinNum += restCoinNum; 
        }
        if (0 != a) {
        	restCoinNum = a % 10;
        	sumCoinNum += restCoinNum; 
        }
        System.out.println(sumCoinNum);
	}

}
0