結果

問題 No.126 2基のエレベータ
ユーザー tnoda_
提出日時 2015-08-12 00:03:46
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 217 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 06:46:18
合計ジャッジ時間 1,025 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B, S = map(int, raw_input().strip().split())
if abs(S - A) <= abs(S - B):
    print(abs(S - A) + S)
elif A == 0:
    print(B + 1)
else:
    ans = abs(S - B)
    ans += min(S + A - 1, abs(S - A) + A)
    print(ans)
0