結果

問題 No.135 とりあえず1次元の問題
ユーザー abL8ZLsTbF
提出日時 2016-08-21 02:20:21
言語 C#(csc)
(csc 3.9.0)
結果
RE  
実行時間 -
コード長 435 bytes
コンパイル時間 2,304 ms
コンパイル使用メモリ 106,880 KB
実行使用メモリ 32,640 KB
最終ジャッジ日時 2024-06-11 06:53:14
合計ジャッジ時間 3,756 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 1
other AC * 11 RE * 11
権限があれば一括ダウンロードができます
コンパイルメッセージ
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))
			.Distinct().OrderBy(i => i).ToArray();
		if (X.Length == 1)
		{
			Console.WriteLine(0);
			return;
		}
		int ans = int.MaxValue;
		for (int i = 1; i < N; i++)
		{
			ans = Math.Min(ans, X[i] - X[i - 1]);
		}
		Console.WriteLine(ans);
	}
}
0