結果

問題 No.135 とりあえず1次元の問題
ユーザー swdamdrswdamdr
提出日時 2017-01-26 09:53:08
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 618 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 110,572 KB
実行使用メモリ 30,756 KB
最終ジャッジ日時 2023-09-02 00:48:28
合計ジャッジ時間 5,103 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
30,216 KB
testcase_01 AC 59 ms
21,568 KB
testcase_02 AC 60 ms
21,564 KB
testcase_03 AC 60 ms
19,520 KB
testcase_04 AC 61 ms
21,572 KB
testcase_05 AC 63 ms
23,840 KB
testcase_06 AC 61 ms
23,548 KB
testcase_07 AC 58 ms
23,616 KB
testcase_08 AC 59 ms
19,568 KB
testcase_09 AC 63 ms
23,612 KB
testcase_10 AC 60 ms
21,660 KB
testcase_11 AC 59 ms
21,772 KB
testcase_12 AC 68 ms
21,680 KB
testcase_13 AC 59 ms
21,624 KB
testcase_14 AC 67 ms
21,876 KB
testcase_15 AC 68 ms
21,948 KB
testcase_16 AC 65 ms
21,704 KB
testcase_17 AC 66 ms
21,720 KB
testcase_18 AC 107 ms
23,780 KB
testcase_19 AC 63 ms
21,716 KB
testcase_20 AC 67 ms
21,704 KB
testcase_21 WA -
testcase_22 AC 126 ms
28,196 KB
evil01.txt AC 124 ms
28,300 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
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        int[] x = Console.ReadLine().Split().Select(xx => int.Parse(xx)).ToArray();
        Array.Sort(x);
        int min = 100001;

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

        if (min == 100001)
        {
            min = 0;
        }

        Console.WriteLine(min);
        Console.Read();
    }
}

0