結果

問題 No.99 ジャンピング駒
ユーザー 明智重蔵明智重蔵
提出日時 2015-11-03 16:42:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 114 ms / 5,000 ms
コード長 1,548 bytes
コンパイル時間 2,309 ms
コンパイル使用メモリ 110,476 KB
実行使用メモリ 38,324 KB
最終ジャッジ日時 2023-10-11 13:24:45
合計ジャッジ時間 3,999 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
34,360 KB
testcase_01 AC 113 ms
36,300 KB
testcase_02 AC 113 ms
38,172 KB
testcase_03 AC 113 ms
38,192 KB
testcase_04 AC 112 ms
38,324 KB
testcase_05 AC 114 ms
38,304 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;

class Program
{
    static string InputPattern = "InputX";

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

        if (InputPattern == "Input1") {
            WillReturn.Add("4");
            WillReturn.Add("1 2 4 3");
            //0
        }
        else if (InputPattern == "Input2") {
            WillReturn.Add("10");
            WillReturn.Add("-746 0 11 98 1 14 998 123 837 15");
            //0
            //なんかうまくやれば全部消滅するらしいです
        }
        else if (InputPattern == "Input3") {
            WillReturn.Add("5");
            WillReturn.Add("1000000000 -1000000000 0 987654321 -123456789");
            //1
            //駒が消滅するときは2個セットで消滅するので、
            //最後にどうしても1個の駒は残ってしまいます。
            //また,4個の駒を消滅させることができます。
        }
        else {
            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        }
        return WillReturn;
    }

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

        //偶数の数
        int EvenCnt = XArr.Count(X => X % 2 == 0);

        //奇数の数
        int OddCnt = XArr.Length - EvenCnt;

        Console.WriteLine(Math.Abs(EvenCnt - OddCnt));
    }
}
0