結果

問題 No.412 花火大会
ユーザー 明智重蔵明智重蔵
提出日時 2016-09-10 12:46:27
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 2,255 bytes
コンパイル時間 2,715 ms
コンパイル使用メモリ 108,284 KB
実行使用メモリ 23,932 KB
最終ジャッジ日時 2023-08-10 13:31:15
合計ジャッジ時間 5,936 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,984 KB
testcase_01 AC 62 ms
23,840 KB
testcase_02 AC 62 ms
21,904 KB
testcase_03 AC 62 ms
21,996 KB
testcase_04 AC 63 ms
23,900 KB
testcase_05 AC 62 ms
21,868 KB
testcase_06 AC 63 ms
19,892 KB
testcase_07 AC 62 ms
21,944 KB
testcase_08 AC 62 ms
23,932 KB
testcase_09 AC 62 ms
19,752 KB
testcase_10 AC 63 ms
23,916 KB
testcase_11 AC 63 ms
23,908 KB
testcase_12 AC 63 ms
23,920 KB
testcase_13 AC 62 ms
21,864 KB
testcase_14 AC 62 ms
19,952 KB
testcase_15 AC 63 ms
21,740 KB
testcase_16 AC 62 ms
21,848 KB
testcase_17 AC 64 ms
21,884 KB
testcase_18 AC 63 ms
21,816 KB
testcase_19 AC 64 ms
21,948 KB
testcase_20 AC 64 ms
21,740 KB
testcase_21 AC 63 ms
21,808 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;

//YukiCoder412 花火大会
//http://yukicoder.me/problems/no/412
class Program
{
    static string InputPattern = "InputX";

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

        if (InputPattern == "Input1") {
            WillReturn.Add("2 4 6");
            WillReturn.Add("4");
            WillReturn.Add("1 3 5 7");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("1 1 1");
            WillReturn.Add("4");
            WillReturn.Add("1 1 1 1");
            //5
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("100 100 100");
            WillReturn.Add("1");
            WillReturn.Add("10");
            //0
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("15 25 35");
            WillReturn.Add("10");
            WillReturn.Add("10 20 30 40 50 60 70 80 90 100");
            //932
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();
        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();

        //昇順にシートを割り当てるのでソートしておく
        Array.Sort(wkArr);
        int B = wkArr[0];
        int C = wkArr[1];
        int D = wkArr[2];

        //昇順にシートを割り当てるのでソートしておく
        int[] EArr = InputList[2].Split(' ').Select(X => int.Parse(X)).ToArray();
        Array.Sort(EArr);

        //場合の数[座れる家族数]なDP表
        int[] DPArr = new int[4];
        DPArr[0] = 1;

        foreach (int EachInt in EArr) {
            for (int I = 3; 0 <= I; I--) {
                int NewInd = I;
                if (I == 0 && B <= EachInt) NewInd = 1;
                if (I == 1 && C <= EachInt) NewInd = 2;
                if (I == 2 && D <= EachInt) NewInd = 3;

                //和の法則
                DPArr[NewInd] += DPArr[I];
            }
        }
        Console.WriteLine(DPArr[3]);
    }
}
0