結果

問題 No.135 とりあえず1次元の問題
ユーザー abL8ZLsTbF
提出日時 2016-08-21 02:25:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 1,116 ms
コンパイル使用メモリ 106,368 KB
実行使用メモリ 32,512 KB
最終ジャッジ日時 2024-06-11 06:54:23
合計ジャッジ時間 3,364 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;

public class Program
{
	public static void Main()
	{
		int N = int.Parse(Console.ReadLine());
		int[] X = Console.ReadLine().Split().Select(i => int.Parse(i))
			.OrderBy(i => i).Distinct().ToArray();
		int len = X.Length;
		if (len == 1)
		{
			Console.WriteLine(0);
			return;
		}
		int ans = int.MaxValue;
		for (int i = 1; i < len; i++)
		{
			ans = Math.Min(ans, X[i] - X[i - 1]);
		}
		Console.WriteLine(ans);
	}
}
0