結果
| 問題 |
No.135 とりあえず1次元の問題
|
| コンテスト | |
| ユーザー |
kmtrc130
|
| 提出日時 | 2017-06-27 09:36:22 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 84 ms / 5,000 ms |
| コード長 | 635 bytes |
| コンパイル時間 | 1,023 ms |
| コンパイル使用メモリ | 105,856 KB |
| 実行使用メモリ | 28,160 KB |
| 最終ジャッジ日時 | 2024-10-04 11:22:28 |
| 合計ジャッジ時間 | 3,006 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
class Program
{
public void Solve()
{
int ans = 0;
int N = int.Parse(Console.ReadLine());
int[] X = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
Array.Sort(X);
for (int i = 0; i < N - 1; i++)
{
if (X[i] == X[i + 1]) { continue; }
if (ans == 0 || Math.Abs(X[i] - X[i + 1]) < ans) { ans = Math.Abs(X[i] - X[i + 1]); }
}
Console.WriteLine(ans);
}
static void Main()
{
var solver = new Program();
solver.Solve();
}
}
kmtrc130