結果

問題 No.126 2基のエレベータ
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-07-04 10:08:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 3,416 ms
コンパイル使用メモリ 72,856 KB
実行使用メモリ 56,124 KB
最終ジャッジ日時 2023-09-13 17:26:03
合計ジャッジ時間 8,846 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 125 ms
56,124 KB
testcase_02 AC 126 ms
55,808 KB
testcase_03 AC 128 ms
56,072 KB
testcase_04 AC 130 ms
55,868 KB
testcase_05 AC 127 ms
55,616 KB
testcase_06 AC 132 ms
55,524 KB
testcase_07 AC 129 ms
55,624 KB
testcase_08 AC 129 ms
55,648 KB
testcase_09 AC 128 ms
55,664 KB
testcase_10 AC 128 ms
55,812 KB
testcase_11 AC 131 ms
55,824 KB
testcase_12 AC 131 ms
55,688 KB
testcase_13 AC 131 ms
55,836 KB
testcase_14 AC 131 ms
55,700 KB
testcase_15 AC 126 ms
55,760 KB
testcase_16 WA -
testcase_17 AC 132 ms
55,936 KB
testcase_18 AC 128 ms
55,720 KB
testcase_19 AC 129 ms
56,012 KB
testcase_20 AC 126 ms
55,824 KB
testcase_21 AC 128 ms
55,440 KB
testcase_22 AC 125 ms
55,680 KB
testcase_23 AC 127 ms
55,660 KB
testcase_24 AC 127 ms
55,496 KB
testcase_25 AC 126 ms
55,960 KB
testcase_26 AC 126 ms
55,456 KB
testcase_27 AC 126 ms
55,424 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

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