結果
問題 | No.29 パワーアップ |
ユーザー | 明智重蔵 |
提出日時 | 2015-07-18 11:56:53 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 69 ms / 5,000 ms |
コード長 | 1,692 bytes |
コンパイル時間 | 2,349 ms |
コンパイル使用メモリ | 110,812 KB |
実行使用メモリ | 24,068 KB |
最終ジャッジ日時 | 2023-09-22 18:57:16 |
合計ジャッジ時間 | 5,330 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
24,068 KB |
testcase_01 | AC | 67 ms
21,988 KB |
testcase_02 | AC | 66 ms
22,096 KB |
testcase_03 | AC | 66 ms
21,968 KB |
testcase_04 | AC | 66 ms
24,016 KB |
testcase_05 | AC | 67 ms
24,036 KB |
testcase_06 | AC | 67 ms
21,972 KB |
testcase_07 | AC | 67 ms
21,880 KB |
testcase_08 | AC | 67 ms
23,916 KB |
testcase_09 | AC | 68 ms
21,992 KB |
testcase_10 | AC | 69 ms
21,968 KB |
testcase_11 | AC | 68 ms
23,980 KB |
testcase_12 | AC | 67 ms
21,924 KB |
testcase_13 | AC | 67 ms
21,932 KB |
testcase_14 | AC | 68 ms
21,844 KB |
testcase_15 | AC | 69 ms
22,012 KB |
testcase_16 | AC | 67 ms
22,016 KB |
testcase_17 | AC | 69 ms
21,988 KB |
testcase_18 | AC | 67 ms
19,864 KB |
testcase_19 | AC | 67 ms
21,996 KB |
testcase_20 | AC | 67 ms
21,948 KB |
testcase_21 | AC | 66 ms
21,896 KB |
コンパイルメッセージ
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 = "Input4"; static List<string> GetInputList() { var WillReturn = new List<string>(); if (InputPattern == "Input1") { WillReturn.Add("5"); WillReturn.Add("1 2 3"); WillReturn.Add("4 5 6"); WillReturn.Add("7 8 9"); WillReturn.Add("10 1 2"); WillReturn.Add("3 4 5"); } else if (InputPattern == "Input2") { WillReturn.Add("3"); WillReturn.Add("1 1 1"); WillReturn.Add("1 1 1"); WillReturn.Add("1 1 1"); } else if (InputPattern == "Input3") { WillReturn.Add("3"); WillReturn.Add("1 2 3"); WillReturn.Add("5 4 1"); WillReturn.Add("1 9 2"); } else { string wkStr; while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr); } return WillReturn; } static void Main() { List<string> InputList = GetInputList(); IEnumerable<int> EnumItem = InputList.Skip(1).SelectMany(X => X.Split(' '), (X, Y) => int.Parse(Y)); int PowerUpCnt = 0; //アイテムごとのCountを求める var Query = EnumItem.GroupBy(X => X).Select(X => new { X.Key, cnt = X.Count() }); //同じアイテムが2つあればパワーアップ PowerUpCnt += Query.Sum(X => X.cnt / 2); //アイテムを4つ使ってパワーアップ PowerUpCnt += Query.Sum(X => X.cnt % 2) / 4; Console.WriteLine(PowerUpCnt); } }