結果

問題 No.126 2基のエレベータ
ユーザー kuramubonnkuramubonn
提出日時 2023-02-04 15:36:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 355 bytes
コンパイル時間 2,900 ms
コンパイル使用メモリ 72,096 KB
実行使用メモリ 58,276 KB
最終ジャッジ日時 2023-09-16 12:10:42
合計ジャッジ時間 6,700 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 120 ms
55,748 KB
testcase_03 AC 120 ms
55,532 KB
testcase_04 AC 119 ms
55,872 KB
testcase_05 AC 119 ms
55,864 KB
testcase_06 AC 120 ms
55,840 KB
testcase_07 WA -
testcase_08 AC 120 ms
56,120 KB
testcase_09 AC 119 ms
55,632 KB
testcase_10 AC 120 ms
56,184 KB
testcase_11 AC 120 ms
56,068 KB
testcase_12 AC 121 ms
55,948 KB
testcase_13 AC 120 ms
55,808 KB
testcase_14 AC 120 ms
55,736 KB
testcase_15 AC 118 ms
56,336 KB
testcase_16 WA -
testcase_17 AC 123 ms
56,064 KB
testcase_18 AC 121 ms
55,552 KB
testcase_19 AC 120 ms
55,804 KB
testcase_20 AC 118 ms
55,632 KB
testcase_21 AC 119 ms
55,892 KB
testcase_22 AC 118 ms
56,112 KB
testcase_23 AC 120 ms
55,836 KB
testcase_24 AC 120 ms
55,580 KB
testcase_25 AC 120 ms
55,976 KB
testcase_26 AC 120 ms
55,840 KB
testcase_27 AC 117 ms
55,588 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
class Main{
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt(),b = sc.nextInt(),s = sc.nextInt(),count = 0;
		if(Math.abs(a - s) <= Math.abs(b - s) || s == 1)
			count += Math.abs(a - s) + s;
		else 
			count += Math.abs(b - s) + (s - 1) + a;
		System.out.println(count);
	}
}
0