結果
問題 |
No.99 ジャンピング駒
|
ユーザー |
![]() |
提出日時 | 2015-11-03 16:42:23 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 79 ms / 5,000 ms |
コード長 | 1,548 bytes |
コンパイル時間 | 1,168 ms |
コンパイル使用メモリ | 110,800 KB |
実行使用メモリ | 42,052 KB |
最終ジャッジ日時 | 2024-09-13 12:09:17 |
合計ジャッジ時間 | 2,832 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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)); } }