結果
| 問題 | 
                            No.126 2基のエレベータ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-03-20 18:46:42 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 558 bytes | 
| コンパイル時間 | 153 ms | 
| コンパイル使用メモリ | 82,288 KB | 
| 実行使用メモリ | 54,004 KB | 
| 最終ジャッジ日時 | 2025-03-20 18:46:58 | 
| 合計ジャッジ時間 | 2,226 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 13 WA * 14 | 
ソースコード
A, B, S = map(int, input().split())
min_total = float('inf')
if S == 1:
    # Case 1: Press down button (only A can come)
    total_case1 = abs(S - A) + S
    min_total = min(min_total, total_case1)
    
    # Case 2: Press up button (normal condition)
    a_dist = abs(S - A)
    b_dist = abs(S - B)
    if a_dist <= b_dist:
        total_case2 = a_dist + S
        min_total = min(min_total, total_case2)
else:
    a_dist = abs(S - A)
    b_dist = abs(S - B)
    if a_dist <= b_dist:
        total = a_dist + S
        min_total = total
print(min_total)
            
            
            
        
            
lam6er