結果

問題 No.135 とりあえず1次元の問題
ユーザー abL8ZLsTbFabL8ZLsTbF
提出日時 2016-08-21 02:25:23
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 165 ms / 5,000 ms
コード長 454 bytes
コンパイル時間 2,243 ms
コンパイル使用メモリ 104,072 KB
実行使用メモリ 35,336 KB
最終ジャッジ日時 2023-09-02 00:29:20
合計ジャッジ時間 5,642 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
31,264 KB
testcase_01 AC 67 ms
21,672 KB
testcase_02 AC 66 ms
21,736 KB
testcase_03 AC 66 ms
21,836 KB
testcase_04 AC 68 ms
21,700 KB
testcase_05 AC 68 ms
23,880 KB
testcase_06 AC 68 ms
21,780 KB
testcase_07 AC 69 ms
21,820 KB
testcase_08 AC 67 ms
21,900 KB
testcase_09 AC 68 ms
19,688 KB
testcase_10 AC 67 ms
21,824 KB
testcase_11 AC 67 ms
19,780 KB
testcase_12 AC 75 ms
22,028 KB
testcase_13 AC 68 ms
19,740 KB
testcase_14 AC 76 ms
23,932 KB
testcase_15 AC 77 ms
23,980 KB
testcase_16 AC 77 ms
21,996 KB
testcase_17 AC 76 ms
21,944 KB
testcase_18 AC 74 ms
21,952 KB
testcase_19 AC 76 ms
22,012 KB
testcase_20 AC 76 ms
21,848 KB
testcase_21 AC 160 ms
31,736 KB
testcase_22 AC 165 ms
35,336 KB
evil01.txt AC 162 ms
33,368 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;

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