結果

問題 No.131 マンハッタン距離
ユーザー r_ishida
提出日時 2025-05-10 20:46:32
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 5,000 ms
コード長 476 bytes
コンパイル時間 298 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 10,368 KB
最終ジャッジ日時 2025-05-10 20:46:35
合計ジャッジ時間 2,327 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
import sys
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

x, y, d = MI()

if x > y:
    x, y = y, x

if d <= x:
    print(d+1)
elif d <= y:
    print(x+1)
elif d <= x + y:
    print(x + y - d + 1)
else:
    print(0)
0