結果

問題 No.135 とりあえず1次元の問題
ユーザー kmtrc130kmtrc130
提出日時 2017-06-27 09:36:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 82 ms / 5,000 ms
コード長 635 bytes
コンパイル時間 764 ms
コンパイル使用メモリ 112,264 KB
実行使用メモリ 34,324 KB
最終ジャッジ日時 2024-04-15 02:39:44
合計ジャッジ時間 2,794 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
32,028 KB
testcase_01 AC 28 ms
27,300 KB
testcase_02 AC 30 ms
25,268 KB
testcase_03 AC 26 ms
23,472 KB
testcase_04 AC 29 ms
27,552 KB
testcase_05 AC 28 ms
27,292 KB
testcase_06 AC 28 ms
27,560 KB
testcase_07 AC 27 ms
25,388 KB
testcase_08 AC 27 ms
25,380 KB
testcase_09 AC 27 ms
27,312 KB
testcase_10 AC 27 ms
27,416 KB
testcase_11 AC 27 ms
25,396 KB
testcase_12 AC 31 ms
27,884 KB
testcase_13 AC 27 ms
25,504 KB
testcase_14 AC 37 ms
27,656 KB
testcase_15 AC 31 ms
25,588 KB
testcase_16 AC 33 ms
27,648 KB
testcase_17 AC 31 ms
25,760 KB
testcase_18 AC 32 ms
25,840 KB
testcase_19 AC 32 ms
25,504 KB
testcase_20 AC 32 ms
25,632 KB
testcase_21 AC 72 ms
34,324 KB
testcase_22 AC 81 ms
34,032 KB
evil01.txt AC 77 ms
31,940 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;

class Program
{
    public void Solve()
    {
        int ans = 0;
        int N = int.Parse(Console.ReadLine());
        int[] X = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        Array.Sort(X);

        for (int i = 0; i < N - 1; i++)
        {
            if (X[i] == X[i + 1]) { continue; }

            if (ans == 0 || Math.Abs(X[i] - X[i + 1]) < ans) { ans = Math.Abs(X[i] - X[i + 1]); }
        }
        Console.WriteLine(ans);
    }

    static void Main()
    {
        var solver = new Program();
        solver.Solve();
    }
}
0