結果

問題 No.48 ロボットの操縦
ユーザー Fullmoon85072Fullmoon85072
提出日時 2020-08-01 22:14:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 5,000 ms
コード長 858 bytes
コンパイル時間 645 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 71,380 KB
最終ジャッジ日時 2023-09-22 18:08:52
合計ジャッジ時間 4,049 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,272 KB
testcase_01 AC 72 ms
71,300 KB
testcase_02 AC 71 ms
71,092 KB
testcase_03 AC 72 ms
71,084 KB
testcase_04 AC 70 ms
71,252 KB
testcase_05 AC 71 ms
71,000 KB
testcase_06 AC 71 ms
71,088 KB
testcase_07 AC 71 ms
71,300 KB
testcase_08 AC 71 ms
71,304 KB
testcase_09 AC 71 ms
71,108 KB
testcase_10 AC 70 ms
71,068 KB
testcase_11 AC 71 ms
70,956 KB
testcase_12 AC 70 ms
71,208 KB
testcase_13 AC 70 ms
71,304 KB
testcase_14 AC 71 ms
71,088 KB
testcase_15 AC 70 ms
71,244 KB
testcase_16 AC 72 ms
70,944 KB
testcase_17 AC 72 ms
71,348 KB
testcase_18 AC 72 ms
71,240 KB
testcase_19 AC 71 ms
71,092 KB
testcase_20 AC 72 ms
71,108 KB
testcase_21 AC 73 ms
71,380 KB
testcase_22 AC 71 ms
71,340 KB
testcase_23 AC 74 ms
71,132 KB
testcase_24 AC 73 ms
71,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math


def move_count(length_for_one_move, length):
    if length == 0:
        return 0
    else:
        return math.ceil(length / length_for_one_move)


if __name__ == "__main__":
    X = int(input())
    Y = int(input())
    L = int(input())

    total_order_count = 0

    if Y >= 0:
        # Y軸方向へ前進
        total_order_count += move_count(L, Y)

        if not X == 0:
            # 90度回転
            total_order_count += 1

            # X軸方向へ前進
            total_order_count += move_count(L, abs(X))

    else:
        # 90度回転
        total_order_count += 1

        # X軸方向へ前進
        total_order_count += move_count(L, abs(X))

        # 90度回転
        total_order_count += 1

        # Y軸方向へ前進
        total_order_count += move_count(L, abs(Y))

    print(total_order_count)
0