結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
30,900 KB
testcase_01 AC 62 ms
22,240 KB
testcase_02 AC 62 ms
22,136 KB
testcase_03 AC 61 ms
22,116 KB
testcase_04 AC 64 ms
22,200 KB
testcase_05 AC 62 ms
22,192 KB
testcase_06 AC 62 ms
22,188 KB
testcase_07 AC 61 ms
20,192 KB
testcase_08 AC 63 ms
24,256 KB
testcase_09 AC 62 ms
22,292 KB
testcase_10 AC 63 ms
24,288 KB
testcase_11 AC 62 ms
24,240 KB
testcase_12 AC 69 ms
24,352 KB
testcase_13 AC 63 ms
22,244 KB
testcase_14 AC 70 ms
24,400 KB
testcase_15 AC 69 ms
22,244 KB
testcase_16 AC 70 ms
24,336 KB
testcase_17 AC 69 ms
22,408 KB
testcase_18 AC 68 ms
22,420 KB
testcase_19 AC 69 ms
20,360 KB
testcase_20 AC 69 ms
22,340 KB
testcase_21 WA -
testcase_22 AC 126 ms
30,992 KB
evil01.txt AC 125 ms
28,920 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(Math.Abs((int)min));
        Console.Read();
    }
}

0