結果

問題 No.135 とりあえず1次元の問題
ユーザー ixTL255
提出日時 2017-01-22 21:16:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 77 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 875 ms
コンパイル使用メモリ 105,088 KB
実行使用メモリ 28,160 KB
最終ジャッジ日時 2024-06-11 07:10:06
合計ジャッジ時間 2,519 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 Test
{
	public static void Main()
	{
		Console.ReadLine();
		var x = Console.ReadLine().Split(' ')
			.Select(n => int.Parse(n)).ToArray();
		
		Array.Sort(x);
		
		var ans = 1000001;
		for(int i = 1; i < x.Length; ++i)
		{
			if(x[i] == x[i - 1]) continue;
			ans = (ans < x[i] - x[i - 1]) ? ans : x[i] - x[i - 1];
		}
		
		if(ans == 1000001) ans = 0;
		Console.WriteLine(ans);
	}
}
0