結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-03-22 02:17:52 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 770 bytes |
| コンパイル時間 | 1,933 ms |
| コンパイル使用メモリ | 77,472 KB |
| 実行使用メモリ | 41,540 KB |
| 最終ジャッジ日時 | 2024-12-24 07:04:53 |
| 合計ジャッジ時間 | 6,469 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 WA * 13 |
ソースコード
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws FileNotFoundException {
long t = System.currentTimeMillis();
new Main().run();
System.err.println(System.currentTimeMillis() - t);
}
void run() {
Scanner sc = new Scanner(System.in);
int A=sc.nextInt();
int B=sc.nextInt();
int S=sc.nextInt();
if(Math.abs(S-A)<=Math.abs(S-B)) {
System.out.println(Math.abs(S-A)+Math.abs(S-0));
}else {
if(A>0) {
System.out.println(Math.abs(S-B)+Math.abs(A-B)+Math.abs(A));
}else {
System.out.println(Math.abs(S-B)+Math.abs(B-1)+2);
}
}
}
static void tr(Object... objects) {
System.out.println(Arrays.deepToString(objects));
}
}