結果

問題 No.46 はじめのn歩
ユーザー tetsukicktetsukick
提出日時 2017-04-26 14:47:47
言語 PHP
(8.3.4)
結果
RE  
実行時間 -
コード長 426 bytes
コンパイル時間 46 ms
コンパイル使用メモリ 11,992 KB
実行使用メモリ 12,432 KB
最終ジャッジ日時 2023-10-11 13:47:01
合計ジャッジ時間 805 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
No syntax errors detected in Main.php

ソースコード

diff #

<?php
$x = trim(fgets(STDIN));
$y = trim(fgets(STDIN));
$maxLength = trim(fgets(STDIN));
$count = 0;

if ($x != 0) {
    if($y >= 0){
        $count++;
    }else{
        $count +=2;
    }
}

$absX=abs($x);
$absY=abs($y);

$countX=$absX/$maxLength;
if($absX%$maxLength != 0){
    $countX++;
}

$countY=$absY/$maxLength;

if($absY%$maxLength != 0){
    $countY++;
}

$count = $count + (int)$countX + (int)$countY;

echo $count;
0