結果

問題 No.78 クジ付きアイスバー
ユーザー 明智重蔵明智重蔵
提出日時 2015-08-03 22:12:28
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 2,203 bytes
コンパイル時間 2,340 ms
コンパイル使用メモリ 105,472 KB
実行使用メモリ 36,480 KB
最終ジャッジ日時 2024-04-16 05:17:19
合計ジャッジ時間 15,984 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
36,480 KB
testcase_01 AC 27 ms
18,944 KB
testcase_02 AC 28 ms
18,688 KB
testcase_03 AC 27 ms
18,944 KB
testcase_04 AC 28 ms
18,944 KB
testcase_05 AC 1,262 ms
18,816 KB
testcase_06 AC 3,214 ms
19,072 KB
testcase_07 AC 1,424 ms
18,816 KB
testcase_08 AC 2,067 ms
18,688 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class Program
{
    static string InputPattern = "Input6";

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

        if (InputPattern == "Input1") {
            WillReturn.Add("5 4");
            WillReturn.Add("01200");
            //2
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("2 8");
            WillReturn.Add("10");
            //4
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("10 100");
            WillReturn.Add("2222222222");
            //1
        }
        else if (InputPattern == "Input4") {
            WillReturn.Add("2 5");
            WillReturn.Add("01");
            //3
        }
        else if (InputPattern == "Input5") { //最悪計算量
            WillReturn.Add("50 2000000000");
            WillReturn.Add(new string('0', 50));
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

    static int K;
    static char[] SArr;

    static void Main()
    {
        //var sw = System.Diagnostics.Stopwatch.StartNew();

        List<string> InputList = GetInputList();
        K = int.Parse(InputList[0].Split(' ').Last());
        SArr = InputList[1].ToCharArray();

        Solve();
        //Console.WriteLine("経過時間={0}", sw.Elapsed);
    }

    static void Solve()
    {
        int HonsuuSum = 0;
        int KounyuuCnt = 0;
        int AtariHonsuu = 0;

        for (int HakoCnt = 1; ; HakoCnt++) {
            foreach (char EachChar in SArr) {
                if (AtariHonsuu == 0) KounyuuCnt++;
                else AtariHonsuu--;

                if (EachChar == '1') AtariHonsuu++;
                if (EachChar == '2') AtariHonsuu += 2;

                if (++HonsuuSum == K) {
                    Console.WriteLine(KounyuuCnt);
                    return;
                }
            }
            //Console.WriteLine("{0}箱目の結果。購入数={1}。当たり本数={2}",
            //    HakoCnt, KounyuuCnt, AtariHonsuu);
        }
    }
}
0