結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
htensai
|
| 提出日時 | 2020-02-06 09:05:01 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 518 bytes |
| コンパイル時間 | 2,204 ms |
| コンパイル使用メモリ | 74,224 KB |
| 実行使用メモリ | 41,720 KB |
| 最終ジャッジ日時 | 2024-09-25 02:57:03 |
| 合計ジャッジ時間 | 6,865 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 3 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int s = sc.nextInt();
int ans;
if (a == 0 || Math.abs(s - a) <= Math.abs(s - b)) {
ans = Math.abs(s - a) + s;
} else {
ans = Math.min(Math.abs(s - b) + s - 1 + Math.abs(a - 1) + 1, Math.abs(s - b) + Math.abs(s - a) + a);
}
System.out.println(ans);
}
}
htensai