結果

問題 No.32 貯金箱の憂鬱
ユーザー curryudon08curryudon08
提出日時 2020-02-11 22:31:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 5,000 ms
コード長 858 bytes
コンパイル時間 2,109 ms
コンパイル使用メモリ 103,432 KB
実行使用メモリ 23,828 KB
最終ジャッジ日時 2023-09-30 13:48:09
合計ジャッジ時間 3,391 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
23,828 KB
testcase_01 AC 56 ms
21,844 KB
testcase_02 AC 57 ms
21,656 KB
testcase_03 AC 57 ms
21,652 KB
testcase_04 AC 57 ms
21,656 KB
testcase_05 AC 57 ms
23,728 KB
testcase_06 AC 56 ms
19,708 KB
testcase_07 AC 57 ms
23,684 KB
testcase_08 AC 56 ms
21,736 KB
testcase_09 AC 56 ms
21,636 KB
testcase_10 AC 56 ms
23,680 KB
testcase_11 AC 56 ms
21,592 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;
using System.Collections.Generic;

namespace _0032
{
    class Program
    {
        static void Main(string[] args)
        {
            var coins = new int[4];
            coins[0] = 0;
            foreach(var i in Enumerable.Range(1,3)){
                coins[i] = int.Parse(Console.ReadLine());
            }
            Array.Reverse(coins);
            
            var changes = new int[3]{25,4,10};
            foreach(var i in Enumerable.Range(0,3)){
                while(true){
                    if(coins[i] - changes[i] >= 0){
                        coins[i] -= changes[i];
                        coins[i+1] += 1;
                    }else{
                        break;
                    }
                }
            }

            Console.WriteLine(coins[0] + coins[1] + coins[2]);
        }
    }
}
0