結果

問題 No.29 パワーアップ
ユーザー CroweaCrowea
提出日時 2019-02-04 13:24:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 836 bytes
コンパイル時間 1,008 ms
コンパイル使用メモリ 65,896 KB
実行使用メモリ 23,800 KB
最終ジャッジ日時 2023-08-26 05:24:49
合計ジャッジ時間 3,354 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
21,704 KB
testcase_01 AC 61 ms
23,684 KB
testcase_02 AC 59 ms
23,800 KB
testcase_03 AC 59 ms
23,756 KB
testcase_04 AC 59 ms
21,812 KB
testcase_05 AC 58 ms
21,664 KB
testcase_06 AC 59 ms
21,684 KB
testcase_07 AC 60 ms
23,672 KB
testcase_08 AC 57 ms
21,712 KB
testcase_09 AC 60 ms
19,676 KB
testcase_10 AC 62 ms
21,700 KB
testcase_11 AC 58 ms
21,632 KB
testcase_12 AC 58 ms
21,624 KB
testcase_13 AC 57 ms
21,820 KB
testcase_14 AC 59 ms
23,728 KB
testcase_15 AC 60 ms
23,728 KB
testcase_16 AC 59 ms
21,740 KB
testcase_17 AC 59 ms
21,824 KB
testcase_18 AC 60 ms
21,764 KB
testcase_19 AC 61 ms
21,832 KB
testcase_20 AC 57 ms
21,720 KB
testcase_21 AC 57 ms
21,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
    public static void Main(string[] args)
    {
        var map = new Dictionary<int, int>();
        var n = int.Parse(Console.ReadLine());

        int[] items;
        for (var i = 0; i < n; i++)
        {
            items = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            foreach (var data in items)
            {
                if (map.ContainsKey(data)) map[data]++;
                else map.Add(data, 1);
            }
        }
        var ans = 0;
        var temp = 0;
        for (var i = 0; i < map.Values.Count(); i++)
        {
            ans += map.ElementAt(i).Value / 2;
            temp += map.ElementAt(i).Value % 2;
        }
        ans += temp / 4;
        Console.WriteLine(ans);
    }
}
0