結果
問題 | No.99 ジャンピング駒 |
ユーザー |
![]() |
提出日時 | 2024-10-10 22:42:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 89 ms / 5,000 ms |
コード長 | 1,757 bytes |
コンパイル時間 | 918 ms |
コンパイル使用メモリ | 107,520 KB |
実行使用メモリ | 33,792 KB |
最終ジャッジ日時 | 2024-10-10 22:42:49 |
合計ジャッジ時間 | 2,008 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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//座標2にいる駒が座標1にいる駒を飛び越え、//その後,座標4にいる駒が座標3にいる駒を飛び越えれば//全ての駒が消滅します}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));}}