結果

問題 No.32 貯金箱の憂鬱
ユーザー nesaianesaia
提出日時 2017-04-17 17:59:26
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 841 bytes
コンパイル時間 3,276 ms
コンパイル使用メモリ 74,168 KB
実行使用メモリ 56,436 KB
最終ジャッジ日時 2023-09-26 10:49:11
合計ジャッジ時間 6,189 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

//No.32 貯金箱の憂鬱
//http://yukicoder.me/problems/5
//20170417 1732

package no32;

import java.util.Scanner;

public class Chr001 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int[] Kouka = new int[]{1, 25, 100};
		int Shihei = 1000;
		int in1, in25, in100;
		
		in1 = scan.nextInt();
		in25 = scan.nextInt();
		in100 = scan.nextInt();

		scan.close();
		
		if( Kouka[1] < in1){
			in25 += in1 * Kouka[0] / Kouka[1];
			in1 = in1 - (in1 * Kouka[0] / Kouka[1]) * Kouka[1] / Kouka[0];
		}
		if( Kouka[2] < in25 * Kouka[1]){
			in100 += in25 *  Kouka[1] / Kouka[2];
			in25 = in25- (in25 *  Kouka[1] / Kouka[2]) * Kouka[2] / Kouka[1];
		}
		if( Shihei < in100 * Kouka[2]){
			in100 = in100 - (in100 * Kouka[2] / Shihei) * Shihei / Kouka[2];
		}
		System.out.println(in1 + in25  + in100);
	}

}
0