結果

問題 No.29 パワーアップ
ユーザー HimatsubushinHimatsubushin
提出日時 2019-01-11 07:45:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 5,000 ms
コード長 943 bytes
コンパイル時間 3,901 ms
コンパイル使用メモリ 104,620 KB
実行使用メモリ 23,824 KB
最終ジャッジ日時 2023-08-18 03:51:04
合計ジャッジ時間 6,230 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,780 KB
testcase_01 AC 60 ms
21,648 KB
testcase_02 AC 60 ms
23,824 KB
testcase_03 AC 60 ms
21,768 KB
testcase_04 AC 60 ms
21,816 KB
testcase_05 AC 60 ms
21,808 KB
testcase_06 AC 62 ms
21,752 KB
testcase_07 AC 60 ms
21,800 KB
testcase_08 AC 61 ms
21,748 KB
testcase_09 AC 62 ms
19,652 KB
testcase_10 AC 61 ms
23,760 KB
testcase_11 AC 61 ms
19,688 KB
testcase_12 AC 59 ms
21,708 KB
testcase_13 AC 60 ms
21,648 KB
testcase_14 AC 60 ms
23,716 KB
testcase_15 AC 61 ms
23,748 KB
testcase_16 AC 61 ms
21,824 KB
testcase_17 AC 60 ms
21,752 KB
testcase_18 AC 60 ms
21,904 KB
testcase_19 AC 61 ms
23,696 KB
testcase_20 AC 60 ms
21,812 KB
testcase_21 AC 60 ms
21,808 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 No029_パワーアップ
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] item =  Enumerable.Repeat(0, 10).ToArray();
            int n = int.Parse(Console.ReadLine());
            int powerup, count;

            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                int[] gift = input.Select(int.Parse).ToArray();

                for (int j = 0; j < 3; j++)
                    item[gift[j] - 1]++;
            }

            powerup = count = 0;

            for (int i = 0; i < 10; i++)
            {
                powerup += item[i] / 2;
                item[i] %= 2;
            }

            for (int i = 0; i < 10; i++)
                if (item[i] > 0)
                    count++;
            powerup += count / 4;

            Console.WriteLine(powerup);
        }
    }
}
0