結果

問題 No.29 パワーアップ
ユーザー Charlotte8687Charlotte8687
提出日時 2018-12-03 10:47:34
言語 C#
(csc 3.9.0)
結果
AC  
実行時間 55 ms / 5,000 ms
コード長 927 bytes
コンパイル時間 3,007 ms
実行使用メモリ 22,804 KB
最終ジャッジ日時 2023-02-01 07:27:07
合計ジャッジ時間 5,190 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
20,892 KB
testcase_01 AC 54 ms
20,768 KB
testcase_02 AC 55 ms
20,780 KB
testcase_03 AC 53 ms
20,900 KB
testcase_04 AC 53 ms
20,844 KB
testcase_05 AC 54 ms
20,836 KB
testcase_06 AC 54 ms
22,804 KB
testcase_07 AC 54 ms
20,820 KB
testcase_08 AC 53 ms
20,776 KB
testcase_09 AC 53 ms
20,724 KB
testcase_10 AC 53 ms
20,884 KB
testcase_11 AC 54 ms
18,736 KB
testcase_12 AC 53 ms
20,784 KB
testcase_13 AC 54 ms
20,776 KB
testcase_14 AC 55 ms
20,816 KB
testcase_15 AC 54 ms
20,884 KB
testcase_16 AC 53 ms
20,816 KB
testcase_17 AC 53 ms
20,728 KB
testcase_18 AC 53 ms
18,724 KB
testcase_19 AC 55 ms
22,744 KB
testcase_20 AC 53 ms
18,776 KB
testcase_21 AC 53 ms
20,848 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace StudyApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int enemy_num = int.Parse(Console.ReadLine());
            int[] items = new int[10];
            int powerUp = 0;

            for (int i = 0; i < enemy_num; i++)
            {
                string[] inputs = Console.ReadLine().Split(' ');
                foreach (var data in inputs)
                {
                    items[int.Parse(data) - 1] += 1;
                    if (items[int.Parse(data) - 1] >= 2)
                    {
                        powerUp++;
                        items[int.Parse(data) - 1] -= 2;
                    }
                }
            }

            int total = 0;
            foreach (var value in items)
            {
                total += value;
            }

            powerUp += total / 4;
            Console.WriteLine(powerUp);
        }
    }
}
0