結果

問題 No.135 とりあえず1次元の問題
ユーザー d_nishiyama85
提出日時 2015-05-04 12:12:41
言語 PHP
(843.2)
結果
WA  
実行時間 -
コード長 424 bytes
コンパイル時間 2,048 ms
コンパイル使用メモリ 36,248 KB
実行使用メモリ 46,892 KB
最終ジャッジ日時 2025-01-03 05:40:49
合計ジャッジ時間 3,099 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

4
0 1 1 0
1
~/dev/yukicoder/135 $ php 135.php
3
0 51 100
49
~/dev/yukicoder/135 $ cat 135.php
<?php
$N = trim(fgets(STDIN));

$points = explode(' ', trim(fgets(STDIN)));

sort($points);

$min = PHP_INT_MAX;

for($i = 0, $c = count($points); $i < $c - 1; $i++) {
	if (($diff = $points[$i+1] - $points[$i]) > 0) {
		$min = min($min, $diff);
	}
}

if ($min == PHP_INT_MAX || $min == 0) {
	echo "0\n";
} else {
	echo "$min\n";
}
0