結果

問題 No.126 2基のエレベータ
ユーザー kanra661kanra661
提出日時 2015-01-13 23:41:37
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 6,203 ms
コンパイル使用メモリ 71,540 KB
実行使用メモリ 57,920 KB
最終ジャッジ日時 2023-09-04 06:09:46
合計ジャッジ時間 9,965 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 133 ms
55,484 KB
testcase_02 WA -
testcase_03 AC 132 ms
55,640 KB
testcase_04 AC 132 ms
55,892 KB
testcase_05 AC 130 ms
55,824 KB
testcase_06 WA -
testcase_07 AC 138 ms
55,732 KB
testcase_08 AC 130 ms
55,624 KB
testcase_09 AC 131 ms
55,696 KB
testcase_10 AC 128 ms
55,780 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 131 ms
55,592 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 128 ms
55,860 KB
testcase_19 AC 128 ms
55,800 KB
testcase_20 WA -
testcase_21 AC 128 ms
55,804 KB
testcase_22 AC 125 ms
55,900 KB
testcase_23 AC 133 ms
55,620 KB
testcase_24 AC 130 ms
55,612 KB
testcase_25 AC 128 ms
55,628 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class No_126 {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int s = sc.nextInt();
		sc.close();

		int dis_a = 0;
		int dis_b = 0;
		if (a - s > 0) {
			dis_a = a - s;
		} else {
			dis_a = s - a;
		}
		if (b - s > 0) {
			dis_b = b - s;
		} else {
			dis_b = s - b;
		}
		if(a==0) s+=1;
		if (dis_b >= dis_a) {
			System.out.println(dis_a + s);
		}else{
			System.out.println(dis_b+a+s);
		}
	}

}
0