結果

問題 No.131 マンハッタン距離
ユーザー nbisco
提出日時 2017-01-24 23:55:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 28 ms / 5,000 ms
コード長 342 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-12-23 08:06:47
合計ジャッジ時間 1,844 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

x, y, d = map(int, input().split(" "))

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