結果

問題 No.32 貯金箱の憂鬱
ユーザー mustonmuston
提出日時 2016-05-18 10:47:33
言語 Java21
(openjdk 21)
結果
AC  
実行時間 131 ms / 5,000 ms
コード長 785 bytes
コンパイル時間 2,316 ms
コンパイル使用メモリ 72,524 KB
実行使用メモリ 55,956 KB
最終ジャッジ日時 2023-09-30 08:08:51
合計ジャッジ時間 4,264 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
55,872 KB
testcase_01 AC 124 ms
55,744 KB
testcase_02 AC 122 ms
55,608 KB
testcase_03 AC 126 ms
55,820 KB
testcase_04 AC 127 ms
55,824 KB
testcase_05 AC 131 ms
55,804 KB
testcase_06 AC 124 ms
55,544 KB
testcase_07 AC 122 ms
55,656 KB
testcase_08 AC 123 ms
55,544 KB
testcase_09 AC 122 ms
55,868 KB
testcase_10 AC 125 ms
55,956 KB
testcase_11 AC 123 ms
55,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
/*yukicoder No.32 貯金箱の憂鬱*/
class No32{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    //それぞれの硬貨の枚数を入力
    int l = scan.nextInt();  //100円硬貨
    int m = scan.nextInt();  //25円硬貨
    int n = scan.nextInt();  //1円硬貨
    //1円硬貨25枚をを25円硬貨1枚に両替
    while(25<=n){
      n -= 25;
      m += 1;
    }
    //25円硬貨4枚を100円硬貨1枚に両替
    while(4<=m){
      m -= 4;
      l += 1;
    }
    //100円硬貨10枚を1000円札1枚に両替
    //(1000円札は数えないのでカウントしない)
    while(10<=l){
      l -= 10;
    }
    //全ての硬貨の枚数を出力
    System.out.println(l+m+n);
  }
}
0