結果

問題 No.48 ロボットの操縦
ユーザー takaaaa6
提出日時 2022-03-07 19:20:16
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 717 bytes
コンパイル時間 114 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-22 14:23:38
合計ジャッジ時間 1,873 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def xset(x):
    global X,shift

    if x == 0:
        X = 0

    elif x%L == 0:
        shift += 1
        X = int(abs(x)/L)


    elif x%L != 0:
        shift += 1
        X = int(abs(x)/L)+1

    return X

if Y == 0:
    xset(X)

elif Y > 0:
    if Y%L == 0:
        Y = int(abs(Y)/L)
        xset(X)

    else:
        Y = int(abs(Y)/L)+1
        xset(X)

elif Y < 0:
    if Y%L == 0:
        xset(X)
        if X == 0:
            shift += 2
        else:
            shift += 1
        Y = int(abs(Y)/L)

    else:
        xset(X)
        if X == 0:
            shift += 2
        else:
            shift += 1
        Y = int(abs(Y)/L)+1

print(X+Y+shift)
0