結果

問題 No.178 美しいWhitespace (1)
ユーザー po1415
提出日時 2015-06-03 00:39:51
言語 PHP
(843.2)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 350 bytes
コンパイル時間 2,480 ms
コンパイル使用メモリ 32,020 KB
実行使用メモリ 32,532 KB
最終ジャッジ日時 2024-07-06 13:50:54
合計ジャッジ時間 4,167 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
fscanf(STDIN, '%d', $num);

$indentList = array();
for ($i = 0; $i < $num; $i++) {
	fscanf(STDIN, '%d %d', $sp, $tab);
	$indentList[] = $sp + ($tab * 4);
}

$max = max($indentList);
$ans = 0;
foreach ($indentList as $indent) {
	$diff = $max - $indent;
	if ($diff % 2 === 0) {
		$ans += $diff / 2;
	} else {
		echo -1;
		exit;
	}
}
echo $ans;
?>
0