結果

問題 No.349 干支の置き物
ユーザー huffman56
提出日時 2022-11-05 09:57:24
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 838 bytes
コンパイル時間 1,153 ms
コンパイル使用メモリ 105,472 KB
実行使用メモリ 18,816 KB
最終ジャッジ日時 2024-07-19 05:02:03
合計ジャッジ時間 3,160 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Linq;
using System.Numerics;
using static System.Math;

namespace SortItems
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = new Dictionary<string, int>();

            for (var i = 0; i < n; i++)
            {
                var s = Console.ReadLine();
                if (d.ContainsKey(s))
                {
                    d[s]++;
                }
                else
                {
                    d[s] = 1;
                }
            }

            if (d.Values.Max() < (n+1)/2+ 1)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }

        }
    }
}
0