結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー phspls
提出日時 2020-03-27 00:01:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 68 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 2,644 ms
コンパイル使用メモリ 117,712 KB
実行使用メモリ 32,692 KB
最終ジャッジ日時 2025-01-02 07:42:53
合計ジャッジ時間 5,161 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Linq;
using System.Collections.Generic;

public class P0079 {
    public static void Main() {
        var n = int.Parse(Console.ReadLine().Trim());
        var dict = new Dictionary<int, int>();
        foreach(int i in Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToList()) {
            dict[i] = dict.GetValueOrDefault(i) + 1;
        }
        var entries = dict.AsEnumerable().ToList();
        Console.WriteLine(entries.OrderByDescending(pair => pair.Value).ThenByDescending(pair => pair.Key).First().Key);
    }
}
0