結果

問題 No.135 とりあえず1次元の問題
ユーザー shimadandyshimadandy
提出日時 2016-09-27 13:27:18
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 145 ms / 5,000 ms
コード長 667 bytes
コンパイル時間 3,766 ms
コンパイル使用メモリ 103,888 KB
実行使用メモリ 31,848 KB
最終ジャッジ日時 2023-09-02 00:35:40
合計ジャッジ時間 6,578 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 143 ms
29,736 KB
testcase_01 AC 64 ms
23,948 KB
testcase_02 AC 62 ms
21,924 KB
testcase_03 AC 62 ms
23,904 KB
testcase_04 AC 61 ms
22,044 KB
testcase_05 AC 60 ms
21,900 KB
testcase_06 AC 65 ms
22,004 KB
testcase_07 AC 61 ms
24,040 KB
testcase_08 AC 62 ms
21,980 KB
testcase_09 AC 62 ms
19,904 KB
testcase_10 AC 63 ms
21,896 KB
testcase_11 AC 62 ms
21,928 KB
testcase_12 AC 70 ms
24,100 KB
testcase_13 AC 63 ms
23,916 KB
testcase_14 AC 72 ms
22,200 KB
testcase_15 AC 70 ms
22,088 KB
testcase_16 AC 69 ms
22,268 KB
testcase_17 AC 72 ms
22,060 KB
testcase_18 AC 68 ms
24,124 KB
testcase_19 AC 69 ms
24,148 KB
testcase_20 AC 70 ms
20,116 KB
testcase_21 AC 143 ms
30,220 KB
testcase_22 AC 145 ms
31,848 KB
evil01.txt AC 141 ms
29,792 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.Linq;
using System.Collections.Generic;

class Program
{
    /// <summary>
    /// プログラムのエントリポイント
    /// </summary>
    /// <param name="args"></param>
    static void Main(string[] args)
    {
        Console.ReadLine();
        var val = Console.ReadLine().Split(' ').Select((s) => int.Parse(s)).OrderBy((n) => n).ToArray();

        int ans = int.MaxValue;
        for(int i = 0; i < val.Length - 1; i++)
        {
            int range = val[i + 1] - val[i];
            if (range > 0 && ans > range)
                ans = range;
        }

        Console.WriteLine(ans == int.MaxValue ? 0 : ans);
    }
}
0