結果

問題 No.32 貯金箱の憂鬱
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-09-11 15:20:41
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 817 bytes
コンパイル時間 2,900 ms
コンパイル使用メモリ 74,040 KB
実行使用メモリ 41,624 KB
最終ジャッジ日時 2024-04-25 06:44:29
合計ジャッジ時間 3,830 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 114 ms
41,472 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

class No_32{
	public static void main (String[] args){
        Scanner sc= new Scanner(System.in);

        int l = sc.nextInt();  //1円玉の数
        int m = sc.nextInt();  //25円玉の数
        int n = sc.nextInt();  //100円玉の数

        if(l/25>0){  //1円玉が25枚より多い時
             m = m + (l/25);   //1円玉が25枚超えた分を25円玉と両替
             l = l - (l/25)*25;   //両替した分を引く
        }

        if(m/4>0){   //25円玉が4枚より多い時
             n = n + (m/4);    //25円玉が4枚超えた分を100円玉と両替
             m = m - (m/4)*4;  //両替した分を引く
        }

        if(n/10>0){  //100円玉が10枚より多い時
             n = n - (n/10);
        }

        System.out.print(m+n+l);
	}
}
0