結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
aaaaasatori
|
| 提出日時 | 2018-02-19 17:54:29 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 589 bytes |
| 記録 | |
| コンパイル時間 | 2,481 ms |
| コンパイル使用メモリ | 83,608 KB |
| 実行使用メモリ | 41,856 KB |
| 最終ジャッジ日時 | 2026-03-30 02:29:32 |
| 合計ジャッジ時間 | 5,344 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 WA * 4 |
ソースコード
import java.util.Scanner;
public class No126 {
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 l = 0; //距離
if(S == 0) {
System.out.println(0);
return;
}
if(S == 1) {
System.out.println(Math.abs(A-S) + S);
return;
}
if(Math.abs(A-S) <= Math.abs(B-S)) {
System.out.println(Math.abs(A-S) + S);
}else if(Math.abs(S-1) <= Math.abs(S-A)) {
System.out.println(Math.abs(S-B)+S-1+A);
}
else {
System.out.println(Math.abs(A-B)+A);
}
}
}
aaaaasatori