結果

問題 No.32 貯金箱の憂鬱
ユーザー dogwood0424dogwood0424
提出日時 2017-11-28 13:48:25
言語 Java19
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 1,005 bytes
コンパイル時間 3,536 ms
コンパイル使用メモリ 72,028 KB
実行使用メモリ 56,024 KB
最終ジャッジ日時 2023-09-30 12:45:49
合計ジャッジ時間 5,932 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
55,912 KB
testcase_01 AC 127 ms
55,504 KB
testcase_02 AC 128 ms
55,784 KB
testcase_03 AC 128 ms
56,024 KB
testcase_04 AC 129 ms
55,928 KB
testcase_05 AC 126 ms
55,800 KB
testcase_06 AC 127 ms
55,888 KB
testcase_07 AC 128 ms
56,024 KB
testcase_08 AC 129 ms
55,964 KB
testcase_09 AC 128 ms
55,980 KB
testcase_10 AC 128 ms
55,504 KB
testcase_11 AC 127 ms
55,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

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


		int l,m,n;

		do {
			l=sc.nextInt();		//100円硬貨の初期枚数
			m=sc.nextInt();		//25円硬貨の初期枚数
			n=sc.nextInt();		//1円硬貨の初期枚数
		}while(!((0<=l && l<=1000)||(0<=m && m<=1000)||(0<=n && n<=1000)));

		int T=0;				//1000円紙幣の枚数
		int L=0;				//100円硬貨の枚数
		int M=0;				//25円硬貨の枚数
		int N=0;				//1円硬貨の枚数

		M = n/25;				//1円硬貨を25円硬貨へ両替
		n = n%25;				//残った1円硬貨の枚数
		M = M+m;				//両替後の25円硬貨の枚数

		L = M/4;				//25円硬貨を100円硬貨へ両替
		m = M%4;				//残った25円硬貨の枚数
		L = L+l;				//両替後の100円硬貨の枚数

		T = L/10;				//100円硬貨を1000円紙幣へ両替
		l = L%10;				//残った100円硬貨の枚数
		T = T;					//両替後の1000円紙幣の枚数


		System.out.println(n+m+l);

	}

}
0