結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-10-15 18:39:42 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 618 bytes |
| コンパイル時間 | 1,766 ms |
| コンパイル使用メモリ | 74,752 KB |
| 実行使用メモリ | 41,560 KB |
| 最終ジャッジ日時 | 2024-07-20 19:52:02 |
| 合計ジャッジ時間 | 6,026 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 WA * 6 |
ソースコード
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 (s == 1) {
if (a == 0) {
ans = 2;
} else {
ans = a;
}
} else {
if (Math.abs(a - s) > Math.abs(b - s)) {
ans = Math.abs(b - s);
if (a == 0) {
ans += s - 1 + 2;
} else {
ans += Math.abs(a - s) + a;
}
} else {
ans = Math.abs(s - a) + s;
}
}
System.out.println(ans);
}
}
tenten