結果

問題 No.29 パワーアップ
ユーザー SagTokiSagToki
提出日時 2018-06-08 13:46:54
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 63 ms / 5,000 ms
コード長 1,341 bytes
コンパイル時間 2,330 ms
コンパイル使用メモリ 102,360 KB
実行使用メモリ 22,680 KB
最終ジャッジ日時 2023-09-12 23:17:56
合計ジャッジ時間 4,665 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
20,620 KB
testcase_01 AC 60 ms
22,532 KB
testcase_02 AC 61 ms
18,660 KB
testcase_03 AC 61 ms
20,496 KB
testcase_04 AC 60 ms
20,604 KB
testcase_05 AC 59 ms
20,624 KB
testcase_06 AC 60 ms
20,460 KB
testcase_07 AC 61 ms
18,564 KB
testcase_08 AC 59 ms
18,584 KB
testcase_09 AC 60 ms
20,568 KB
testcase_10 AC 60 ms
20,572 KB
testcase_11 AC 59 ms
20,612 KB
testcase_12 AC 63 ms
20,616 KB
testcase_13 AC 59 ms
20,524 KB
testcase_14 AC 60 ms
20,532 KB
testcase_15 AC 60 ms
20,616 KB
testcase_16 AC 60 ms
22,560 KB
testcase_17 AC 59 ms
20,456 KB
testcase_18 AC 60 ms
20,584 KB
testcase_19 AC 60 ms
22,552 KB
testcase_20 AC 60 ms
22,680 KB
testcase_21 AC 60 ms
22,564 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.Collections.Generic;

namespace Yukicorder_029 {
    class Program{
        static void Main(string[] args) {
            int N = InputN(1, 100);
            int Level = 0;
            var list = new List<string>();
            var Items = new List<string>();
            for (int i = 0; i < N; i++) {
                list.AddRange(Console.ReadLine().Split());
            }
            foreach (String Match in list) {
                if(!Items.Contains(Match)) {
                    Items.Add(Match);
                }else{
                    Items.Remove(Match);
                    Level++;
                }
            }
            Level = Level + Items.Count / 4;

            Console.WriteLine(Level);
        }                               

        static int InputN(int Min , int Max) {
            int Number = int.Parse(Console.ReadLine());
            try {
                if(Number < Min || Number > Max) {
                    Console.WriteLine(Min + "以上" + Max + "以下で入力してください");
                }
            }catch(FormatException e) {
                Console.WriteLine("数字を入力してください");
            }catch(Exception E) {
                Console.WriteLine("想定外のエラーです");
            }
            return Number;
        } 
    }
}
0