結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2018-09-13 01:05:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 548 bytes |
コンパイル時間 | 955 ms |
コンパイル使用メモリ | 110,932 KB |
実行使用メモリ | 26,524 KB |
最終ジャッジ日時 | 2024-06-28 10:07:58 |
合計ジャッジ時間 | 2,731 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 29 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.Collections.Generic; class No349 { static void Main() { var num = Int32.Parse(Console.ReadLine()); var dic = new Dictionary<string, int>(); for (int i = 0; i < num; ++i) { var key = Console.ReadLine(); if (dic.ContainsKey(key)) dic.Add(key, 1); else dic[key]++; } var max = dic.Values.Max(); var count = num % 2 == 0 ? num / 2 : num / 2 + 1; Console.WriteLine(max <= count?"YES":"NO"); } }