結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2019-06-22 15:22:16
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 1,023 bytes
コンパイル時間 1,092 ms
コンパイル使用メモリ 67,884 KB
実行使用メモリ 30,500 KB
最終ジャッジ日時 2023-08-27 02:50:39
合計ジャッジ時間 3,831 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
22,372 KB
testcase_01 AC 92 ms
29,832 KB
testcase_02 AC 62 ms
21,936 KB
testcase_03 AC 58 ms
22,072 KB
testcase_04 AC 59 ms
21,996 KB
testcase_05 AC 93 ms
30,012 KB
testcase_06 AC 59 ms
24,040 KB
testcase_07 AC 63 ms
24,064 KB
testcase_08 AC 61 ms
22,112 KB
testcase_09 AC 61 ms
24,044 KB
testcase_10 AC 61 ms
21,864 KB
testcase_11 AC 62 ms
22,040 KB
testcase_12 AC 62 ms
21,912 KB
testcase_13 AC 60 ms
21,936 KB
testcase_14 AC 83 ms
24,192 KB
testcase_15 AC 71 ms
23,200 KB
testcase_16 AC 84 ms
27,092 KB
testcase_17 AC 72 ms
23,060 KB
testcase_18 AC 88 ms
25,036 KB
testcase_19 AC 82 ms
24,020 KB
testcase_20 AC 93 ms
30,500 KB
testcase_21 AC 71 ms
22,316 KB
testcase_22 AC 77 ms
23,304 KB
testcase_23 AC 90 ms
27,604 KB
testcase_24 AC 90 ms
27,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace proconCSharp
{
    class Program
    {
        static int GetInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] GetInts()
        {
            return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        }

        static void Main()
        {
            var N = GetInt();
            var L = GetInts();

            var group = L.GroupBy(x => x);
            

            int ma = 0, ans = 0;
            foreach (var g in group)
            {
                if (ma < g.Count())
                {
                    ma = g.Count();
                    ans = g.ElementAt(0);
                }
                else if (ma == g.Count() && ans < g.ElementAt(0))
                {
                    ans = g.ElementAt(0);
                }
            }
            
            Console.WriteLine($"{ans}");
        }
    }
}
0