結果

問題 No.135 とりあえず1次元の問題
ユーザー phptarophptaro
提出日時 2015-01-30 15:14:26
言語 PHP
(8.2.11)
結果
AC  
実行時間 202 ms / 5,000 ms
コード長 524 bytes
コンパイル時間 1,277 ms
コンパイル使用メモリ 18,264 KB
実行使用メモリ 37,288 KB
最終ジャッジ日時 2023-08-31 01:33:30
合計ジャッジ時間 3,584 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 200 ms
37,140 KB
testcase_01 AC 14 ms
18,948 KB
testcase_02 AC 12 ms
18,892 KB
testcase_03 AC 12 ms
19,016 KB
testcase_04 AC 12 ms
18,968 KB
testcase_05 AC 12 ms
18,948 KB
testcase_06 AC 13 ms
18,708 KB
testcase_07 AC 12 ms
18,880 KB
testcase_08 AC 12 ms
19,056 KB
testcase_09 AC 13 ms
18,960 KB
testcase_10 AC 13 ms
18,932 KB
testcase_11 AC 14 ms
18,972 KB
testcase_12 AC 14 ms
18,940 KB
testcase_13 AC 14 ms
18,800 KB
testcase_14 AC 14 ms
18,944 KB
testcase_15 AC 13 ms
18,908 KB
testcase_16 AC 14 ms
18,908 KB
testcase_17 AC 13 ms
18,996 KB
testcase_18 AC 12 ms
18,984 KB
testcase_19 AC 13 ms
18,936 KB
testcase_20 AC 13 ms
19,008 KB
testcase_21 AC 168 ms
34,944 KB
testcase_22 AC 202 ms
37,288 KB
evil01.txt AC 193 ms
37,404 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$num = trim(fgets(STDIN));
$points = trim(fgets(STDIN));

$arr1 = explode(" ", $points);	//半角スペース区切りの要素を格納
sort($arr1);	//昇順に並び替え
$arr2 = array_unique($arr1, SORT_NUMERIC);	//値の重複を削除
$arr2 = array_merge($arr2);		//重複してとびとびになったインデックスを振り直す

$arr3 = array();
if(count($arr2)  == 1){
	$ans = 0;
}else{
	for($i = 1; $i < count($arr2); $i++){
		$arr3[] = $arr2[$i] - $arr2[($i-1)];

	}
	$ans = min($arr3);

}
	echo $ans;
0