結果

問題 No.126 2基のエレベータ
ユーザー flippergo
提出日時 2025-06-19 08:51:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 297 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 82,580 KB
実行使用メモリ 53,568 KB
最終ジャッジ日時 2025-06-19 08:51:46
合計ジャッジ時間 3,016 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B,S = map(int,input().split())
if abs(S-A)<=abs(S-B):
    print(abs(S-A)+S)
else:
    if S==1 and A>0:
        print(A)
    elif S==1 and A==0:
        print(2)
    elif A>=S:
        print(abs(S-B)+A+min(-S+A,S-1))
    elif 0<A<S:
        print(abs(S-B)+S)
    else:
        print(abs(S-B)+1+S)
0