結果

問題 No.32 貯金箱の憂鬱
ユーザー kashiwagi513kashiwagi513
提出日時 2019-02-19 22:02:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 5,000 ms
コード長 1,050 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 74,092 KB
実行使用メモリ 56,188 KB
最終ジャッジ日時 2023-09-30 13:25:38
合計ジャッジ時間 4,122 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
56,016 KB
testcase_01 AC 113 ms
55,692 KB
testcase_02 AC 116 ms
55,860 KB
testcase_03 AC 116 ms
55,968 KB
testcase_04 AC 114 ms
56,088 KB
testcase_05 AC 113 ms
55,884 KB
testcase_06 AC 115 ms
54,508 KB
testcase_07 AC 112 ms
55,664 KB
testcase_08 AC 113 ms
56,188 KB
testcase_09 AC 116 ms
55,580 KB
testcase_10 AC 112 ms
56,008 KB
testcase_11 AC 115 ms
55,816 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.lang.*;
import java.io.*;

class Main {
    static class Coins{
        int c100; 
        int c25;
        int c1;
        Coins(int a, int b, int c){this.c100 = a; this.c25 = b; this.c1 = c;}
    }
    public static Coins oneToTwentyFive(Coins in) {
        return (new Coins(in.c100, in.c25 + (in.c1/25), in.c1%25));
    }
    public static Coins twentyFiveToHundred(Coins in){
        return new Coins(in.c100 + (in.c25/4), in.c25%4, in.c1);
    }
    public static Coins hundredToThousand(Coins in){
        return new Coins(in.c100%10, in.c25, in.c1);
    }
    public static int coinsToNum(Coins in){
        return in.c100 + in.c25 + in.c1;
    }
    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);
        Coins coins = new Coins(
        	Integer.parseInt(sc.next()),
        	Integer.parseInt(sc.next()),
        	Integer.parseInt(sc.next()));
        System.out.println(
            coinsToNum(hundredToThousand(twentyFiveToHundred(oneToTwentyFive(coins)))));
    }
}
0