結果

問題 No.135 とりあえず1次元の問題
ユーザー nanophoto12nanophoto12
提出日時 2015-12-13 22:12:33
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 124 ms / 5,000 ms
コード長 662 bytes
コンパイル時間 4,964 ms
コンパイル使用メモリ 104,400 KB
実行使用メモリ 28,724 KB
最終ジャッジ日時 2023-09-01 22:58:37
合計ジャッジ時間 8,029 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
26,324 KB
testcase_01 AC 62 ms
19,648 KB
testcase_02 AC 62 ms
21,744 KB
testcase_03 AC 62 ms
21,716 KB
testcase_04 AC 63 ms
21,608 KB
testcase_05 AC 63 ms
21,792 KB
testcase_06 AC 63 ms
21,716 KB
testcase_07 AC 63 ms
21,760 KB
testcase_08 AC 63 ms
21,624 KB
testcase_09 AC 63 ms
21,672 KB
testcase_10 AC 63 ms
23,724 KB
testcase_11 AC 63 ms
23,596 KB
testcase_12 AC 71 ms
21,948 KB
testcase_13 AC 62 ms
23,744 KB
testcase_14 AC 71 ms
23,952 KB
testcase_15 AC 70 ms
23,928 KB
testcase_16 AC 70 ms
23,812 KB
testcase_17 AC 71 ms
21,896 KB
testcase_18 AC 69 ms
21,852 KB
testcase_19 AC 70 ms
21,752 KB
testcase_20 AC 70 ms
23,996 KB
testcase_21 AC 114 ms
28,724 KB
testcase_22 AC 124 ms
26,196 KB
evil01.txt AC 123 ms
28,292 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.Collections.Generic;
using System.Linq;

namespace No135
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Convert.ToInt32 (Console.ReadLine ());
			var data = Console.ReadLine ().Split (' ').Select (v => Convert.ToInt32 (v)).ToArray ();
			Array.Sort (data);
			var minDistance = int.MaxValue;
			for (int i = 0; i < data.Length-1; i++) {
				var distance = data [i + 1] - data [i];
				if (distance != 0) {
					minDistance = Math.Min (minDistance, distance);
				}
			}
			if (minDistance == int.MaxValue) {
				Console.WriteLine ("0");
				return;
			}
			Console.WriteLine (minDistance.ToString ());
		}
	}
}
0