結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2018-09-13 01:09:11 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 28 ms / 2,000 ms |
コード長 | 549 bytes |
コンパイル時間 | 809 ms |
コンパイル使用メモリ | 109,188 KB |
実行使用メモリ | 26,912 KB |
最終ジャッジ日時 | 2024-06-28 10:15:27 |
合計ジャッジ時間 | 2,791 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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.
ソースコード
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[key]++; else dic.Add(key, 1); } var max = dic.Values.Max(); var count = num % 2 == 0 ? num / 2 : num / 2 + 1; Console.WriteLine(max <= count?"YES":"NO"); } }