結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー fujita
提出日時 2023-05-09 14:07:46
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 181 ms / 5,000 ms
コード長 1,181 bytes
コンパイル時間 10,009 ms
コンパイル使用メモリ 167,936 KB
実行使用メモリ 190,044 KB
最終ジャッジ日時 2024-11-26 01:06:40
合計ジャッジ時間 13,891 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (95 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int count = 0 , maxcount = 0 , num = 0;
            var str = Console.ReadLine();
            var g = str.Split(" ");
            string[] strings = new string[g.Length];
            for (int i = 0; i < g.Length; i++)
            {
                
                strings[i] = g[i];//入力された文字を配列に
            }
            Array.Sort(strings);

            for (int j = 0; j < strings.Length - 1; j++)
            {
                if (strings[j] == strings[j + 1])
                {
                    count++;
                    if (maxcount <= count)
                    {
                        maxcount = count;
                        num = int.Parse(strings[j]);
                    }
                }
                else
                {
                    count = 0;
                }
            }
            if (num == 0)
            {
                num = int.Parse(strings[strings.Length - 1]);
            }
            Console.WriteLine(num);
        }
    }
}
0