結果

問題 No.29 パワーアップ
ユーザー うわばみうわばみ
提出日時 2020-04-29 15:12:59
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 716 bytes
コンパイル時間 1,770 ms
コンパイル使用メモリ 63,628 KB
実行使用メモリ 23,996 KB
最終ジャッジ日時 2023-08-19 03:03:18
合計ジャッジ時間 4,104 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
21,824 KB
testcase_01 AC 54 ms
19,892 KB
testcase_02 AC 54 ms
21,840 KB
testcase_03 AC 54 ms
21,892 KB
testcase_04 AC 54 ms
23,996 KB
testcase_05 AC 55 ms
22,000 KB
testcase_06 AC 55 ms
23,992 KB
testcase_07 AC 55 ms
23,944 KB
testcase_08 AC 54 ms
23,952 KB
testcase_09 AC 56 ms
22,064 KB
testcase_10 AC 54 ms
21,908 KB
testcase_11 AC 55 ms
21,900 KB
testcase_12 AC 56 ms
21,816 KB
testcase_13 AC 55 ms
21,836 KB
testcase_14 AC 55 ms
21,908 KB
testcase_15 AC 55 ms
23,936 KB
testcase_16 AC 54 ms
22,064 KB
testcase_17 AC 54 ms
22,036 KB
testcase_18 AC 55 ms
22,040 KB
testcase_19 AC 55 ms
23,868 KB
testcase_20 AC 55 ms
21,940 KB
testcase_21 AC 54 ms
21,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Linq;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] list = new int[n * 3];
        for(int i = 0; i < n; i++)
        {
            int[] num = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray();
            for(int j = 0; j < 3; j++)
            {
                list[i * 3 + j] = num[j];
            }
        }
        Array.Sort(list);
        int pair = 0;
        for(int i = 1; i < list.Length; i++)
        {
            if(list[i - 1] == list[i])
            {
                pair++;
                i++;
            }
        }
        Console.WriteLine($"{pair + (list.Length - pair * 2) / 4}");
    }
}
0