結果

問題 No.32 貯金箱の憂鬱
ユーザー aketijyuuzou
提出日時 2024-10-10 21:38:44
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 24 ms / 5,000 ms
コード長 1,393 bytes
コンパイル時間 839 ms
コンパイル使用メモリ 110,744 KB
実行使用メモリ 23,856 KB
最終ジャッジ日時 2024-10-10 21:38:46
合計ジャッジ時間 1,679 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

        if (InputPattern == "Input1") {
            WillReturn.Add("7");
            WillReturn.Add("20");
            WillReturn.Add("10");
            //12
            //25円硬貨20枚を100円硬貨5枚に両替し、
            //さらに100円硬貨10枚を1000円札に両替するのが最も少なくなります。
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("0");
            WillReturn.Add("0");
            WillReturn.Add("0");
            //0
            //貯金箱は空っぽでした
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int L = int.Parse(InputList[0]);
        int M = int.Parse(InputList[1]);
        int N = int.Parse(InputList[2]);

        int SumMoney = L * 100 + 25 * M + N;

        int CoinCnt = 0;
        SumMoney %= 1000;
        CoinCnt += SumMoney / 100; SumMoney %= 100;
        CoinCnt += SumMoney / 25; SumMoney %= 25;
        CoinCnt += SumMoney;
        Console.WriteLine(CoinCnt);
    }
}

0