結果
問題 |
No.126 2基のエレベータ
|
ユーザー |
![]() |
提出日時 | 2025-06-12 12:47:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 633 bytes |
コンパイル時間 | 198 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 52,224 KB |
最終ジャッジ日時 | 2025-06-12 12:47:28 |
合計ジャッジ時間 | 2,437 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 14 |
ソースコード
A, B, S = map(int, input().split()) min_total = float('inf') if S == 1: # Down button case: B cannot move, so A comes total_down = abs(A - 1) + 1 min_total = min(min_total, total_down) # Up button case: check if A is closer or equal a_dist = abs(A - 1) b_dist = abs(B - 1) if a_dist <= b_dist: total_up = a_dist + 1 min_total = min(min_total, total_up) else: # For other floors, check if A is closer or equal when pressing down button a_dist = abs(A - S) b_dist = abs(B - S) if a_dist <= b_dist: total = a_dist + S min_total = total print(min_total)