結果

問題 No.126 2基のエレベータ
ユーザー Daigo HIROOKA
提出日時 2018-07-04 10:08:29
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 3,444 ms
コンパイル使用メモリ 74,724 KB
実行使用メモリ 54,272 KB
最終ジャッジ日時 2024-07-01 02:07:57
合計ジャッジ時間 8,623 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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();

		if(s == 1){
			System.out.println(Math.abs(s-a)+s);
			return;
		}
		if(Math.abs(s-a) <= Math.abs(s-b)){
			System.out.println(Math.abs(s-a)+s);
		}else{
			System.out.println(Math.abs(s-b)+(s-1)+Math.abs(a-1)+1);
		}
	}
}
0