結果

問題 No.48 ロボットの操縦
ユーザー beatdjambeatdjam
提出日時 2016-10-03 14:56:54
言語 PHP
(8.3.4)
結果
AC  
実行時間 13 ms / 5,000 ms
コード長 643 bytes
コンパイル時間 59 ms
コンパイル使用メモリ 18,640 KB
実行使用メモリ 18,936 KB
最終ジャッジ日時 2023-08-14 00:58:49
合計ジャッジ時間 1,526 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
18,836 KB
testcase_01 AC 13 ms
18,836 KB
testcase_02 AC 13 ms
18,784 KB
testcase_03 AC 13 ms
18,792 KB
testcase_04 AC 13 ms
18,804 KB
testcase_05 AC 12 ms
18,836 KB
testcase_06 AC 11 ms
18,860 KB
testcase_07 AC 13 ms
18,788 KB
testcase_08 AC 13 ms
18,836 KB
testcase_09 AC 13 ms
18,832 KB
testcase_10 AC 13 ms
18,644 KB
testcase_11 AC 13 ms
18,848 KB
testcase_12 AC 13 ms
18,856 KB
testcase_13 AC 12 ms
18,852 KB
testcase_14 AC 13 ms
18,788 KB
testcase_15 AC 13 ms
18,792 KB
testcase_16 AC 13 ms
18,844 KB
testcase_17 AC 13 ms
18,936 KB
testcase_18 AC 13 ms
18,832 KB
testcase_19 AC 13 ms
18,876 KB
testcase_20 AC 12 ms
18,760 KB
testcase_21 AC 13 ms
18,760 KB
testcase_22 AC 12 ms
18,868 KB
testcase_23 AC 13 ms
18,840 KB
testcase_24 AC 13 ms
18,780 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$input_lines = trim(fgets(STDIN));
$input_lines = str_replace(array("\r\n","\r","\n"), "", $input_lines);
do {
    $tmpStr[] = $input_lines;
    $input_lines = trim(fgets(STDIN));
    $input_lines = str_replace(array("\r\n","\r","\n"), "", $input_lines);
} while ($input_lines !== "");

$x = $tmpStr[0];
$y = $tmpStr[1];
$move = $tmpStr[2];

$changeAngleCount = getChangeAngleCount((int)$x,(int)$y);
$moveCount = ceil(abs($x) / $move) + ceil(abs($y) / $move);

echo $changeAngleCount + $moveCount;

function getChangeAngleCount($i_x,$i_y){
	if($i_y >= 0){
		if($i_x === 0){
			return 0;
		}else{
			return 1;
		}
	}else{
		return 2;
	}
}
0