結果

問題 No.48 ロボットの操縦
ユーザー S Y
提出日時 2024-10-19 13:19:15
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 29 ms / 5,000 ms
コード長 626 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-19 13:19:17
合計ジャッジ時間 2,191 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    x = int(input())
    y = int(input())
    l = int(input())

    num_op = 0

    if y == 0:
        if x != 0:
            num_op += 1
            num_op += return_op_cnt(x, l)
    elif y > 0:
        num_op += return_op_cnt(y, l)
        if x != 0:
            num_op += 1
            num_op += return_op_cnt(x, l)
    elif y < 0:
        num_op += 2
        num_op += return_op_cnt(y, l)
        num_op += return_op_cnt(x, l)

    print(num_op)

def return_op_cnt(cor, l):
    dis = abs(cor)

    if dis%l == 0:
        return dis//l
    else:
        return dis//l + 1

if __name__ == '__main__':
    main()
0