結果

問題 No.135 とりあえず1次元の問題
ユーザー mencottonmencotton
提出日時 2017-12-29 21:05:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 633 bytes
コンパイル時間 2,181 ms
コンパイル使用メモリ 103,052 KB
実行使用メモリ 30,304 KB
最終ジャッジ日時 2023-08-23 09:03:30
合計ジャッジ時間 5,040 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
30,304 KB
testcase_01 AC 62 ms
23,624 KB
testcase_02 AC 63 ms
21,608 KB
testcase_03 AC 63 ms
23,680 KB
testcase_04 AC 64 ms
23,884 KB
testcase_05 AC 64 ms
23,768 KB
testcase_06 AC 62 ms
21,740 KB
testcase_07 AC 63 ms
21,588 KB
testcase_08 AC 62 ms
23,664 KB
testcase_09 AC 63 ms
21,608 KB
testcase_10 AC 63 ms
21,556 KB
testcase_11 AC 63 ms
21,708 KB
testcase_12 AC 70 ms
21,744 KB
testcase_13 AC 63 ms
21,712 KB
testcase_14 AC 71 ms
21,752 KB
testcase_15 AC 70 ms
21,748 KB
testcase_16 AC 70 ms
21,756 KB
testcase_17 AC 70 ms
21,728 KB
testcase_18 AC 70 ms
23,780 KB
testcase_19 AC 71 ms
21,880 KB
testcase_20 AC 71 ms
23,828 KB
testcase_21 AC 119 ms
26,828 KB
testcase_22 AC 126 ms
28,368 KB
evil01.txt AC 126 ms
30,312 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;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(x);
            int ret = int.MaxValue;
            for (int i = 1; i < n; i++)
            {
                if (x[i] - x[i - 1] != 0)
                {
                    ret = Math.Min(ret,x[i] - x[i - 1]);
                }
            }
            Console.WriteLine(ret == int.MaxValue ? 0 : ret);
        }
    }
}
0