結果

問題 No.32 貯金箱の憂鬱
ユーザー TwinkleStar74TwinkleStar74
提出日時 2017-09-11 15:57:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 819 bytes
コンパイル時間 4,754 ms
コンパイル使用メモリ 71,284 KB
実行使用メモリ 56,084 KB
最終ジャッジ日時 2023-09-30 12:38:21
合計ジャッジ時間 5,409 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,460 KB
testcase_01 AC 125 ms
55,900 KB
testcase_02 AC 125 ms
55,764 KB
testcase_03 AC 126 ms
55,764 KB
testcase_04 AC 126 ms
56,064 KB
testcase_05 AC 126 ms
55,920 KB
testcase_06 AC 128 ms
56,040 KB
testcase_07 AC 127 ms
55,712 KB
testcase_08 AC 127 ms
55,888 KB
testcase_09 AC 127 ms
55,908 KB
testcase_10 AC 127 ms
56,084 KB
testcase_11 AC 127 ms
55,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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

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

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

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

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

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