結果

問題 No.842 初詣
ユーザー bluemeganebluemegane
提出日時 2021-04-19 07:18:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 667 bytes
コンパイル時間 792 ms
コンパイル使用メモリ 65,504 KB
実行使用メモリ 22,828 KB
最終ジャッジ日時 2023-09-17 08:14:38
合計ジャッジ時間 2,935 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
20,660 KB
testcase_01 AC 57 ms
22,828 KB
testcase_02 AC 57 ms
20,700 KB
testcase_03 AC 56 ms
22,700 KB
testcase_04 AC 56 ms
22,752 KB
testcase_05 AC 56 ms
20,708 KB
testcase_06 AC 56 ms
20,652 KB
testcase_07 AC 56 ms
22,724 KB
testcase_08 AC 56 ms
22,816 KB
testcase_09 AC 57 ms
20,760 KB
testcase_10 AC 56 ms
20,740 KB
testcase_11 AC 56 ms
20,776 KB
testcase_12 AC 57 ms
20,784 KB
testcase_13 AC 57 ms
20,700 KB
testcase_14 AC 57 ms
20,700 KB
testcase_15 AC 56 ms
20,744 KB
testcase_16 AC 56 ms
20,748 KB
testcase_17 AC 57 ms
22,644 KB
testcase_18 AC 56 ms
18,736 KB
testcase_19 AC 57 ms
20,752 KB
testcase_20 AC 56 ms
20,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var m = new int[6];
        for (int i = 0; i < 6; i++) m[i] = int.Parse(line[i]);
        var G = int.Parse(line[6]);
        getAns(G, m);
    }
    static void getAns(int G, int[] m)
    {
        var m2 = new int[] { 500, 100, 50, 10, 5, 1 };
        for (int i = 0; i < 6; i++)
        {
            var p = m[i];
            while (p > 0)
            {
                if (G - m2[i] < 0) break;
                G -= m2[i];
                p--;
            }
        }
        Console.WriteLine(G == 0 ? "YES" : "NO");
    }
}
0