結果

問題 No.126 2基のエレベータ
ユーザー gew1fw
提出日時 2025-06-12 19:32:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 383 bytes
コンパイル時間 232 ms
コンパイル使用メモリ 81,944 KB
実行使用メモリ 53,660 KB
最終ジャッジ日時 2025-06-12 19:32:43
合計ジャッジ時間 2,584 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 19 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B, S = map(int, input().split())

# Scenario 1: Use A directly
scenario1 = abs(A - S) + S

# Scenario 2: Use B first, then A
min_scenario2 = float('inf')
for F in range(1, 101):
    sum_moves = abs(B - S) + abs(F - S) + abs(A - F) + F
    if sum_moves < min_scenario2:
        min_scenario2 = sum_moves

# The minimal total moves
total = min(scenario1, min_scenario2)
print(total)
0