結果

問題 No.135 とりあえず1次元の問題
ユーザー しらゆきしらゆき
提出日時 2015-11-19 14:17:31
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 127 ms / 5,000 ms
コード長 506 bytes
コンパイル時間 3,993 ms
コンパイル使用メモリ 102,300 KB
実行使用メモリ 30,744 KB
最終ジャッジ日時 2023-09-01 21:46:21
合計ジャッジ時間 6,805 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
30,248 KB
testcase_01 AC 62 ms
21,668 KB
testcase_02 AC 61 ms
21,620 KB
testcase_03 AC 62 ms
21,764 KB
testcase_04 AC 62 ms
21,668 KB
testcase_05 AC 62 ms
23,712 KB
testcase_06 AC 63 ms
21,676 KB
testcase_07 AC 62 ms
23,652 KB
testcase_08 AC 63 ms
23,668 KB
testcase_09 AC 62 ms
21,552 KB
testcase_10 AC 63 ms
21,632 KB
testcase_11 AC 63 ms
23,632 KB
testcase_12 AC 71 ms
23,740 KB
testcase_13 AC 62 ms
23,664 KB
testcase_14 AC 71 ms
21,844 KB
testcase_15 AC 70 ms
21,848 KB
testcase_16 AC 71 ms
23,748 KB
testcase_17 AC 70 ms
21,816 KB
testcase_18 AC 69 ms
21,676 KB
testcase_19 AC 71 ms
23,872 KB
testcase_20 AC 70 ms
23,760 KB
testcase_21 AC 120 ms
30,744 KB
testcase_22 AC 126 ms
30,268 KB
evil01.txt AC 124 ms
28,256 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;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();

        Array.Sort(x);
        int ans = 1000001;

        for (int i = 0; i < n - 1; i++)
        {
            if (x[i] != x[i + 1])
            {
                ans = Math.Min(ans, x[i + 1] - x[i]);
            }
        }

        if (ans == 1000001) ans = 0;

        Console.WriteLine(ans);
    }
}
0