結果

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

ソースコード

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