結果

問題 No.3108 Luke or Bishop
ユーザー cyanos
提出日時 2025-04-19 15:11:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 437 bytes
コンパイル時間 652 ms
コンパイル使用メモリ 12,160 KB
実行使用メモリ 11,648 KB
最終ジャッジ日時 2025-04-19 15:11:07
合計ジャッジ時間 3,052 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 2
other RE * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

def minimum_moves(Gx, Gy):
    rook_moves = 0
    if Gx != 0:
        rook_moves += 1
    if Gy != 0:
        rook_moves += 1

    bishop_moves = 2 
    if abs(Gx) == abs(Gy) or (Gx + Gy) == 0:
        bishop_moves = 1
    
    if Gx == 0 and Gy == 0:
        bishop_moves = rook_moves = 0
    
    if rook_moves <= bishop_moves:
        return rook_moves
    else:
        return bishop_moves

moves = minimum_moves(Gx, Gy)
print(moves)
0