結果

問題 No.48 ロボットの操縦
ユーザー Fullmoon85072
提出日時 2020-08-01 22:14:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 38 ms / 5,000 ms
コード長 858 bytes
コンパイル時間 171 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-07-08 09:27:48
合計ジャッジ時間 1,693 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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