結果

問題 No.135 とりあえず1次元の問題
ユーザー swdamdrswdamdr
提出日時 2017-01-26 09:53:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 2,237 ms
コンパイル使用メモリ 104,240 KB
実行使用メモリ 30,896 KB
最終ジャッジ日時 2023-09-02 00:48:34
合計ジャッジ時間 5,332 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
30,264 KB
testcase_01 AC 63 ms
23,776 KB
testcase_02 AC 62 ms
21,784 KB
testcase_03 AC 63 ms
21,752 KB
testcase_04 AC 62 ms
21,636 KB
testcase_05 AC 63 ms
21,732 KB
testcase_06 AC 62 ms
21,720 KB
testcase_07 AC 63 ms
21,676 KB
testcase_08 AC 63 ms
21,784 KB
testcase_09 AC 63 ms
21,592 KB
testcase_10 AC 63 ms
23,736 KB
testcase_11 AC 63 ms
21,700 KB
testcase_12 AC 70 ms
21,876 KB
testcase_13 AC 63 ms
21,772 KB
testcase_14 AC 71 ms
23,920 KB
testcase_15 AC 70 ms
21,820 KB
testcase_16 AC 71 ms
21,908 KB
testcase_17 AC 70 ms
21,892 KB
testcase_18 AC 68 ms
21,780 KB
testcase_19 AC 72 ms
23,976 KB
testcase_20 AC 70 ms
23,812 KB
testcase_21 AC 120 ms
30,896 KB
testcase_22 AC 128 ms
30,344 KB
evil01.txt AC 124 ms
26,236 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 = 1000001;

        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 == 1000001)
        {
            min = 0;
        }

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

0