結果

問題 No.48 ロボットの操縦
ユーザー liyuanliyuan
提出日時 2017-04-26 14:54:44
言語 PHP
(8.3.4)
結果
WA  
実行時間 -
コード長 516 bytes
コンパイル時間 53 ms
コンパイル使用メモリ 12,172 KB
実行使用メモリ 12,332 KB
最終ジャッジ日時 2023-10-11 13:49:00
合計ジャッジ時間 1,220 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
12,092 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 7 ms
12,144 KB
testcase_04 WA -
testcase_05 AC 7 ms
12,152 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php

$X = fgets(STDIN);
$Y = fgets(STDIN);
$L = fgets(STDIN);
$ans = 0;

//方向転換命令が何回必要か
$numTurn = 0;
if($Y<0){
    $numTurn += 2;
}else {
    if($X != 0){
        $numTurn += 1;
    }
}

//進む命令が何回必要か
$numX = 0;
$numY = 0;

if($X % $L == 0){
    $numX = abs($X / $L) ; 
}else{
    $numX = abs($X / $L) + 1;
}

if($Y % $L == 0){
    $numY = abs($Y / $L) ;
}else{
    $numY = abs($Y / $L) + 1;
}

//回数を統合
$ans = $numTurn + $numX + $numY;
echo $ans;
echo "\n";
?>
0