結果

問題 No.706 多眼生物の調査
ユーザー bluemeganebluemegane
提出日時 2018-09-06 10:22:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 67,632 KB
実行使用メモリ 25,768 KB
最終ジャッジ日時 2023-08-13 16:04:17
合計ジャッジ時間 2,878 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
21,696 KB
testcase_01 AC 62 ms
21,576 KB
testcase_02 AC 62 ms
21,644 KB
testcase_03 AC 64 ms
21,588 KB
testcase_04 AC 72 ms
23,648 KB
testcase_05 AC 81 ms
21,748 KB
testcase_06 AC 99 ms
25,768 KB
testcase_07 AC 64 ms
21,468 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Collections.Generic;
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var d = new Dictionary<int, int>();
        var n = int.Parse(Console.ReadLine().Trim());
        for (int i = 0; i < n; i++)
        {
            var s = Console.ReadLine().Trim();
            var a = s.Length - s.Replace("^", "").Length;
            if (d.ContainsKey(a)) d[a]++;
            else d[a] = 1;
        }
        var ans = d.OrderByDescending(x => x.Value).ThenByDescending(x => x.Key).First();
        Console.WriteLine(ans.Key);
    }
}
0