結果

問題 No.126 2基のエレベータ
ユーザー 37zigen37zigen
提出日時 2020-03-22 02:17:52
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 3,658 ms
コンパイル使用メモリ 74,052 KB
実行使用メモリ 58,516 KB
最終ジャッジ日時 2023-08-25 20:52:11
合計ジャッジ時間 7,906 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 121 ms
56,352 KB
testcase_04 AC 122 ms
56,476 KB
testcase_05 AC 120 ms
55,896 KB
testcase_06 AC 119 ms
56,132 KB
testcase_07 WA -
testcase_08 AC 120 ms
53,844 KB
testcase_09 AC 120 ms
55,748 KB
testcase_10 AC 121 ms
56,448 KB
testcase_11 AC 120 ms
55,544 KB
testcase_12 WA -
testcase_13 AC 122 ms
56,208 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 117 ms
56,064 KB
testcase_18 AC 120 ms
56,304 KB
testcase_19 AC 120 ms
56,176 KB
testcase_20 WA -
testcase_21 AC 118 ms
56,208 KB
testcase_22 AC 120 ms
56,304 KB
testcase_23 AC 119 ms
55,796 KB
testcase_24 AC 119 ms
55,744 KB
testcase_25 AC 122 ms
56,132 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

}
0