結果

問題 No.716 距離
ユーザー Crowea
提出日時 2019-01-29 20:05:18
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 592 bytes
コンパイル時間 889 ms
コンパイル使用メモリ 106,752 KB
実行使用メモリ 20,224 KB
最終ジャッジ日時 2024-10-11 06:10:55
合計ジャッジ時間 3,381 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 19 WA * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var lst = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        lst.Sort();

        var min = decimal.MaxValue;
        var max = lst[n-1] - lst[0];
        for (int i=0; i < n-1; i++)
        {
            if (lst[i] == lst[i + 1]) continue;
            min = Math.Min(min, Math.Abs(lst[i + 1] - lst[i]));
        }
        Console.WriteLine( min == decimal.MaxValue ? 0 : min );
        Console.WriteLine( max );
    }
}
 
0