結果

問題 No.126 2基のエレベータ
ユーザー phptarophptaro
提出日時 2015-01-26 10:59:38
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 271 bytes
コンパイル時間 788 ms
コンパイル使用メモリ 18,536 KB
実行使用メモリ 19,016 KB
最終ジャッジ日時 2023-09-05 06:55:41
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 16 ms
18,816 KB
testcase_04 AC 15 ms
18,836 KB
testcase_05 WA -
testcase_06 AC 15 ms
18,868 KB
testcase_07 WA -
testcase_08 AC 16 ms
18,828 KB
testcase_09 AC 15 ms
18,744 KB
testcase_10 AC 15 ms
18,888 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 16 ms
18,852 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 16 ms
18,876 KB
testcase_19 AC 16 ms
18,864 KB
testcase_20 WA -
testcase_21 AC 16 ms
18,828 KB
testcase_22 AC 15 ms
18,868 KB
testcase_23 AC 15 ms
18,776 KB
testcase_24 AC 15 ms
18,868 KB
testcase_25 AC 15 ms
18,904 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
 fscanf(STDIN, "%d %d %d", $A, $B, $S);


$absA = abs($S-$A);
$absB = abs($S-$B);

$ans = 0;

//Aを使うとき
if($absA <= $absB){
	$ans = $absA + $S;
}else{	//Bを使うとき
	$ans = min($absA + $absB + $A, $absB + $A);
	if($A == 0){
		$ans +=1;
	}
}
echo $ans;
0