結果

問題 No.135 とりあえず1次元の問題
ユーザー takeya_okino
提出日時 2017-07-14 13:43:44
言語 PHP
(843.2)
結果
AC  
実行時間 171 ms / 5,000 ms
コード長 281 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 32,524 KB
実行使用メモリ 42,736 KB
最終ジャッジ日時 2024-10-07 20:44:43
合計ジャッジ時間 2,376 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$N = trim(fgets(STDIN));
$X = explode(" ", trim(fgets(STDIN)));
sort($X);
$ans = 10000000;
$small = $X[0];
for($i = 0; $i < $N; $i++) {
  $x = $X[$i];
  if($x > $small) {
    $ans = min($ans, $x - $small);
    $small = $x;
  }
}
if($ans == 10000000) $ans = 0;
print($ans);
?>
0