結果

問題 No.29 パワーアップ
ユーザー wowilsonwowilson
提出日時 2016-10-08 18:24:19
言語 C#
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 795 bytes
コンパイル時間 2,369 ms
使用メモリ 15,872 KB
最終ジャッジ日時 2022-12-27 10:30:55
合計ジャッジ時間 4,845 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 58 ms
15,768 KB
testcase_01 AC 58 ms
15,740 KB
testcase_02 AC 57 ms
15,804 KB
testcase_03 AC 57 ms
15,764 KB
testcase_04 AC 58 ms
15,748 KB
testcase_05 AC 58 ms
15,648 KB
testcase_06 AC 57 ms
15,708 KB
testcase_07 AC 58 ms
15,660 KB
testcase_08 AC 58 ms
15,872 KB
testcase_09 AC 57 ms
15,644 KB
testcase_10 AC 58 ms
15,676 KB
testcase_11 AC 58 ms
15,628 KB
testcase_12 AC 58 ms
15,704 KB
testcase_13 AC 57 ms
15,752 KB
testcase_14 AC 59 ms
15,708 KB
testcase_15 AC 57 ms
15,736 KB
testcase_16 AC 58 ms
15,760 KB
testcase_17 AC 58 ms
15,868 KB
testcase_18 AC 59 ms
15,688 KB
testcase_19 AC 59 ms
15,676 KB
testcase_20 AC 58 ms
15,796 KB
testcase_21 AC 58 ms
15,660 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.Linq;

namespace Yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] list = new int[10];

            for (int i = 0; i < N; i++)
            {
                var data = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                foreach (var d in data)
                {
                    list[d - 1]++;
                }
            }

            int powerup = 0;
            int subPowerup = 0;
            foreach(var l in list)
            {
                powerup += l / 2;
                if (l % 2 == 1)
                    subPowerup++;
            }
            Console.WriteLine(powerup + (subPowerup / 4));
        }
    }
}
0