結果

問題 No.135 とりあえず1次元の問題
ユーザー ixTL255ixTL255
提出日時 2017-01-22 21:16:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 125 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 2,441 ms
コンパイル使用メモリ 103,900 KB
実行使用メモリ 30,516 KB
最終ジャッジ日時 2023-09-02 00:47:11
合計ジャッジ時間 5,263 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
30,516 KB
testcase_01 AC 62 ms
23,868 KB
testcase_02 AC 61 ms
21,904 KB
testcase_03 AC 62 ms
21,956 KB
testcase_04 AC 64 ms
21,784 KB
testcase_05 AC 64 ms
21,848 KB
testcase_06 AC 64 ms
22,004 KB
testcase_07 AC 61 ms
23,828 KB
testcase_08 AC 62 ms
23,912 KB
testcase_09 AC 63 ms
21,760 KB
testcase_10 AC 64 ms
23,908 KB
testcase_11 AC 64 ms
21,764 KB
testcase_12 AC 71 ms
22,060 KB
testcase_13 AC 64 ms
21,812 KB
testcase_14 AC 73 ms
22,104 KB
testcase_15 AC 72 ms
22,000 KB
testcase_16 AC 71 ms
20,024 KB
testcase_17 AC 72 ms
22,036 KB
testcase_18 AC 70 ms
22,020 KB
testcase_19 AC 71 ms
24,112 KB
testcase_20 AC 71 ms
22,016 KB
testcase_21 AC 117 ms
28,936 KB
testcase_22 AC 125 ms
28,704 KB
evil01.txt AC 123 ms
28,564 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 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