結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー 14番14番
提出日時 2016-04-09 20:46:04
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 93 ms / 5,000 ms
コード長 2,058 bytes
コンパイル時間 2,167 ms
コンパイル使用メモリ 107,428 KB
実行使用メモリ 25,480 KB
最終ジャッジ日時 2023-09-08 14:49:57
合計ジャッジ時間 5,038 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
18,992 KB
testcase_01 AC 93 ms
25,292 KB
testcase_02 AC 60 ms
22,700 KB
testcase_03 AC 60 ms
20,844 KB
testcase_04 AC 61 ms
20,640 KB
testcase_05 AC 92 ms
25,432 KB
testcase_06 AC 59 ms
22,764 KB
testcase_07 AC 58 ms
22,784 KB
testcase_08 AC 62 ms
22,676 KB
testcase_09 AC 61 ms
20,692 KB
testcase_10 AC 61 ms
22,748 KB
testcase_11 AC 59 ms
18,652 KB
testcase_12 AC 59 ms
22,768 KB
testcase_13 AC 60 ms
20,628 KB
testcase_14 AC 83 ms
22,024 KB
testcase_15 AC 73 ms
21,528 KB
testcase_16 AC 86 ms
22,752 KB
testcase_17 AC 71 ms
21,512 KB
testcase_18 AC 85 ms
22,820 KB
testcase_19 AC 80 ms
21,860 KB
testcase_20 AC 92 ms
23,412 KB
testcase_21 AC 67 ms
21,056 KB
testcase_22 AC 77 ms
23,636 KB
testcase_23 AC 92 ms
25,316 KB
testcase_24 AC 93 ms
25,480 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Collections.Generic;
using System.Text;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        int userCount = int.Parse(Reader.ReadLine());
        Dictionary<int, int> dic = new Dictionary<int, int>();
        int[] list = Reader.GetInt();
        foreach (int num in list)
        {
            if (dic.ContainsKey(num))
            {
                dic[num]++;
            }
            else
            {
                dic.Add(num, 1);
            }
        }
        int max = int.MinValue;
        int lev = 0;
        foreach (int key in dic.Keys)
        {
            if (dic[key] > max)
            {
                lev = key;
                max = dic[key];
            }
            else if (dic[key] == max && key > lev)
            {
                lev = key;
            }
        }
        Console.WriteLine(lev);

    }



    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"


5
2 1 2 3 2





 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        public static int[] GetInt(char delimiter = ' ', bool trim = false)
        {
            string inptStr = ReadLine();
            if (trim)
            {
                inptStr = inptStr.Trim();
            }
            string[] inpt = inptStr.Split(delimiter);
            int[] ret = new int[inpt.Length];
            for (int i = 0; i < inpt.Length; i++)
            {
                ret[i] = int.Parse(inpt[i]);
            }
            return ret;
        }
    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0