結果

問題 No.32 貯金箱の憂鬱
ユーザー tsk101tsk101
提出日時 2019-08-08 18:10:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 60 ms / 5,000 ms
コード長 1,143 bytes
コンパイル時間 2,941 ms
コンパイル使用メモリ 104,552 KB
実行使用メモリ 22,812 KB
最終ジャッジ日時 2023-09-30 13:34:16
合計ジャッジ時間 4,475 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,684 KB
testcase_01 AC 60 ms
22,692 KB
testcase_02 AC 60 ms
20,756 KB
testcase_03 AC 56 ms
22,784 KB
testcase_04 AC 57 ms
22,812 KB
testcase_05 AC 57 ms
20,636 KB
testcase_06 AC 56 ms
20,888 KB
testcase_07 AC 54 ms
18,672 KB
testcase_08 AC 53 ms
20,844 KB
testcase_09 AC 53 ms
20,804 KB
testcase_10 AC 53 ms
20,780 KB
testcase_11 AC 53 ms
20,728 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.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 競プロ
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            Count100 = int.Parse(s);

            s = Console.ReadLine();
            Count25 = int.Parse(s);

            s = Console.ReadLine();
            Count1 = int.Parse(s);

            Count1000 = 0;

            // 1円 → 25円
            while (Count1 >= 25)
            {
                Count1 -= 25;
                Count25++;
            }

            // 25円 → 100円
            while (Count25 >= 4)
            {
                Count25 -= 4;
                Count100++;
            }

            // 100円 → 1000円
            while (Count100 >= 10)
            {
                Count100 -= 10;
                Count1000++;
            }

            int res = Count1 + Count25 + Count100;
            Console.WriteLine(res.ToString());


            Console.ReadLine();
        }

        private static int Count1, Count25, Count100, Count1000;
    }
}
0