結果

問題 No.29 パワーアップ
ユーザー うわばみうわばみ
提出日時 2020-04-29 15:12:59
言語 C#(mono)
(mono 6.12.0.158)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 716 bytes
コンパイル時間 1,021 ms
使用メモリ 18,064 KB
最終ジャッジ日時 2023-01-05 05:52:11
合計ジャッジ時間 3,716 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 61 ms
15,892 KB
testcase_01 AC 61 ms
16,028 KB
testcase_02 AC 61 ms
15,836 KB
testcase_03 AC 61 ms
17,820 KB
testcase_04 AC 60 ms
15,968 KB
testcase_05 AC 63 ms
18,064 KB
testcase_06 AC 61 ms
17,936 KB
testcase_07 AC 61 ms
15,924 KB
testcase_08 AC 62 ms
15,876 KB
testcase_09 AC 62 ms
17,988 KB
testcase_10 AC 62 ms
17,836 KB
testcase_11 AC 61 ms
15,972 KB
testcase_12 AC 63 ms
17,848 KB
testcase_13 AC 61 ms
15,932 KB
testcase_14 AC 61 ms
16,032 KB
testcase_15 AC 62 ms
15,960 KB
testcase_16 AC 62 ms
18,012 KB
testcase_17 AC 62 ms
15,988 KB
testcase_18 AC 62 ms
17,984 KB
testcase_19 AC 62 ms
17,936 KB
testcase_20 AC 63 ms
15,888 KB
testcase_21 AC 62 ms
15,896 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