結果

問題 No.48 ロボットの操縦
ユーザー brthyyjp
提出日時 2021-06-23 22:19:13
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 691 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 82,456 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-06-24 22:41:58
合計ジャッジ時間 2,397 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

x = int(input())
y = int(input())
l = int(input())

if x == 0:
    if y > 0:
        ans = (y+l-1)//l
        print(ans)
        exit()
    elif y == 0:
        print(0)
        exit()
    else:
        ans = (-y+l-1)//l+1
        print(ans)
        exit()

if y == 0:
    if x > 0:
        ans = (x+l-1)//l+1
        print(ans)
        exit()
    elif x == 0:
        print(0)
        exit()
    else:
        ans = (-x+l-1)//l+1
        print(ans)
        exit()

if x > 0 and y > 0:
    ans = (y+l-1)//l+1+(x+l-1)//l
elif x < 0 and y > 0:
    ans = (y+l-1)//l+1+(-x+l-1)//l
elif x < 0 and y < 0:
    ans = 1+(-x+l-1)//l+1+(-y+l-1)//l
else:
    ans = 1+(x+l-1)//l+1+(-y+l-1)//l
print(ans)
0