結果

問題 No.1285 ゴミ捨て
ユーザー Maeda
提出日時 2025-04-02 11:45:44
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 834 bytes
コンパイル時間 8,335 ms
コンパイル使用メモリ 170,080 KB
実行使用メモリ 192,956 KB
最終ジャッジ日時 2025-04-02 11:45:57
合計ジャッジ時間 12,711 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (115 ミリ秒)。
/home/judge/data/code/Main.cs(7,17): warning CS0219: 変数 'maxsize' は割り当てられていますが、その値は使用されていません [/home/judge/data/code/main.csproj]
/home/judge/data/code/Main.cs(8,17): warning CS0219: 変数 'count' は割り当てられていますが、その値は使用されていません [/home/judge/data/code/main.csproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] sizeList = new int[n];
            int maxsize = 0;
            int count = 0;
            for(int i = 0; i < n; i++)
            {
                sizeList[i] = int.Parse(Console.ReadLine());
            }
            Array.Sort(sizeList);
            bool flg = false;
            for(int i = 0; i < n-1; i++)
            {
                if (sizeList[i + 1] - sizeList[i] > 2)
                {
                    continue;
                }
                flg = true;
            }
            if (flg)
            {
                Console.WriteLine("2");
            }
            else
            {
                Console.WriteLine("1");
            }
            
        }
    }
0