結果

問題 No.48 ロボットの操縦
ユーザー Ixtkc
提出日時 2019-11-09 18:09:18
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 497 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-09-15 04:41:39
合計ジャッジ時間 2,160 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

X = int(input())
Y = int(input())
L = int(input())

# 初期点
x = 0
y = 0
itr = 0

# Yを合わせるのにかかる回数
if Y != 0 and Y % L != 0:
    itr += (abs(Y) // L) + 1
elif Y != 0 and Y % L == 0:
    itr += (abs(Y) // L)

# 向きを変える処理の場合分け
if Y >= 0 and X != 0:
    itr += 1
elif Y < 0:
    itr += 2

# Xを合わせるのにかかる回数
if X != 0 and X % L != 0:
    itr += (abs(X) // L) + 1
elif X != 0 and X % L == 0:
    itr += (abs(X) // L)

print(itr)
0