結果
問題 |
No.79 過小評価ダメ・ゼッタイ
|
ユーザー |
|
提出日時 | 2018-07-25 09:44:55 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 63 ms / 5,000 ms |
コード長 | 860 bytes |
コンパイル時間 | 2,808 ms |
コンパイル使用メモリ | 116,388 KB |
実行使用メモリ | 33,948 KB |
最終ジャッジ日時 | 2024-06-25 13:19:48 |
合計ジャッジ時間 | 5,066 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.
ソースコード
using System; using System.Linq; namespace No79 { class Program { static void Main(string[] args) { var a = Int32.Parse(Console.ReadLine()); var b = Console.ReadLine().Split(' ') .GroupBy(x => x) // 入力の数字をキーにしてグループ化 .OrderByDescending(x => x.Count()) // 要素数の多い順(降順)に並び替え .ThenByDescending(x => x.Key) // 要素数が同数の場合、キーの大きい順(降順)に並び替え .First() // 先頭のグループを取得 .Key; // キーを取得 Console.WriteLine(b); Console.ReadKey(); } } }