結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
28,832 KB
testcase_01 AC 62 ms
20,044 KB
testcase_02 AC 63 ms
22,180 KB
testcase_03 AC 63 ms
24,188 KB
testcase_04 AC 64 ms
22,260 KB
testcase_05 AC 65 ms
22,244 KB
testcase_06 AC 63 ms
22,252 KB
testcase_07 AC 62 ms
22,260 KB
testcase_08 AC 64 ms
24,208 KB
testcase_09 AC 63 ms
22,208 KB
testcase_10 AC 64 ms
20,184 KB
testcase_11 AC 65 ms
22,240 KB
testcase_12 AC 72 ms
20,184 KB
testcase_13 AC 64 ms
24,360 KB
testcase_14 AC 71 ms
24,312 KB
testcase_15 AC 72 ms
20,332 KB
testcase_16 AC 71 ms
22,348 KB
testcase_17 AC 71 ms
24,320 KB
testcase_18 AC 69 ms
22,248 KB
testcase_19 AC 72 ms
24,376 KB
testcase_20 AC 71 ms
22,172 KB
testcase_21 WA -
testcase_22 AC 128 ms
28,824 KB
evil01.txt AC 126 ms
28,988 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);
        double min = Math.Pow(10, 5) + 1;

        for (int i = 1; i < n; i++)
        {
            if (x[i] == x[i - 1])
            {
                continue;
            }

            if (x[i] - x[i - 1] < min)
            {
                min = x[i] - x[i - 1];
            }
        }

        if (min == Math.Pow(10, 5) + 1)
        {
            min = 0;
        }

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

0