結果

問題 No.48 ロボットの操縦
ユーザー butchi_ybutchi_y
提出日時 2014-10-23 23:05:41
言語 JavaScript
(node v20.8.0)
結果
WA  
実行時間 -
コード長 803 bytes
コンパイル時間 142 ms
コンパイル使用メモリ 5,452 KB
実行使用メモリ 44,528 KB
最終ジャッジ日時 2023-08-03 01:26:05
合計ジャッジ時間 3,041 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
42,196 KB
testcase_01 AC 76 ms
42,232 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 76 ms
42,316 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 76 ms
44,280 KB
testcase_08 WA -
testcase_09 AC 76 ms
42,056 KB
testcase_10 WA -
testcase_11 AC 75 ms
42,056 KB
testcase_12 AC 75 ms
42,016 KB
testcase_13 AC 74 ms
42,160 KB
testcase_14 AC 76 ms
42,232 KB
testcase_15 AC 75 ms
42,480 KB
testcase_16 AC 74 ms
42,204 KB
testcase_17 AC 76 ms
42,172 KB
testcase_18 WA -
testcase_19 AC 76 ms
42,052 KB
testcase_20 AC 75 ms
42,188 KB
testcase_21 AC 76 ms
42,168 KB
testcase_22 WA -
testcase_23 AC 77 ms
44,088 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
    var tmp = input.split("\n");
    var x = parseInt(tmp[0], 10);
    var y = parseInt(tmp[1], 10);
    var l = parseInt(tmp[2], 10);

    ans = minStep(x, y, l);
    console.log('%d', ans);

    function minStep(x, y, l) { 
        var absX = Math.abs(x);
        var absY = Math.abs(y);
        if(x === 0 && y === 0) {
            return 4;
        } else if(y === 0) {
            return minLineStep(l, absX);
        } else if(x === 0) {
            return minLineStep(l, absY);
        } else {
            return minLineStep(l, absX) + minLineStep(l, absY) + 1;
        }
    }

    function minLineStep(l, x) {
        return Math.floor((x + l - 1)/l);
    }
}

// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0