結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
nanophoto12
|
| 提出日時 | 2015-12-13 22:12:33 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 92 ms / 5,000 ms |
| コード長 | 662 bytes |
| コンパイル時間 | 4,789 ms |
| コンパイル使用メモリ | 107,136 KB |
| 実行使用メモリ | 28,416 KB |
| 最終ジャッジ日時 | 2025-01-03 10:56:15 |
| 合計ジャッジ時間 | 5,260 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.
ソースコード
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 ());
}
}
}
nanophoto12