結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー yuki2006yuki2006
提出日時 2019-06-22 15:39:21
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 100 ms / 5,000 ms
コード長 1,289 bytes
コンパイル時間 4,277 ms
コンパイル使用メモリ 103,116 KB
実行使用メモリ 26,724 KB
最終ジャッジ日時 2023-08-27 02:54:30
合計ジャッジ時間 5,888 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
22,176 KB
testcase_01 AC 97 ms
26,356 KB
testcase_02 AC 57 ms
23,792 KB
testcase_03 AC 57 ms
19,800 KB
testcase_04 AC 59 ms
19,716 KB
testcase_05 AC 95 ms
26,436 KB
testcase_06 AC 55 ms
23,744 KB
testcase_07 AC 56 ms
21,844 KB
testcase_08 AC 59 ms
21,764 KB
testcase_09 AC 58 ms
21,956 KB
testcase_10 AC 58 ms
21,860 KB
testcase_11 AC 58 ms
21,644 KB
testcase_12 AC 55 ms
21,860 KB
testcase_13 AC 56 ms
21,736 KB
testcase_14 AC 84 ms
23,068 KB
testcase_15 AC 74 ms
22,724 KB
testcase_16 AC 93 ms
24,208 KB
testcase_17 AC 70 ms
24,760 KB
testcase_18 AC 87 ms
26,028 KB
testcase_19 AC 81 ms
25,044 KB
testcase_20 AC 100 ms
26,724 KB
testcase_21 AC 67 ms
24,136 KB
testcase_22 AC 78 ms
25,008 KB
testcase_23 AC 97 ms
26,436 KB
testcase_24 AC 95 ms
26,472 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.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Algorithm
{
    class Program
    {
        static void Logic(List<int> list)
        {
            list.Sort();

            int count = 0;
            int preNumber = 0;
            int countMax = 0;
            int answer = 0;

            for(int i = 0; i < list.Count; i++)
            {
                if (preNumber == list[i])
                {
                    // 前回の数字と同じ場合
                    count++;

                }
                else
                {
                    // 前回の数字と違う場合
                    count = 1;
                    preNumber = list[i];
                }

                if (count >= countMax)
                {
                    // 最大値が同じか超えた場合 その時の更新する
                    countMax = count;
                    answer = list[i];
                }


            }
       

            Console.WriteLine(answer);
        }


        static void Main(string[] args)
        {
            Console.ReadLine(); // N
            var list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            Logic(list);
        }
    }
}
0