結果

問題 No.126 2基のエレベータ
ユーザー AoiroFukurouAoiroFukurou
提出日時 2015-01-25 15:56:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 4,704 ms
コンパイル使用メモリ 72,000 KB
実行使用メモリ 56,696 KB
最終ジャッジ日時 2023-09-05 06:15:14
合計ジャッジ時間 8,901 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 126 ms
56,072 KB
testcase_04 AC 127 ms
55,740 KB
testcase_05 WA -
testcase_06 AC 126 ms
55,892 KB
testcase_07 WA -
testcase_08 AC 126 ms
55,784 KB
testcase_09 AC 123 ms
55,956 KB
testcase_10 AC 126 ms
56,000 KB
testcase_11 AC 126 ms
55,484 KB
testcase_12 AC 124 ms
55,656 KB
testcase_13 AC 122 ms
55,716 KB
testcase_14 AC 121 ms
56,060 KB
testcase_15 AC 121 ms
55,592 KB
testcase_16 WA -
testcase_17 AC 122 ms
55,772 KB
testcase_18 AC 120 ms
55,804 KB
testcase_19 AC 123 ms
55,760 KB
testcase_20 AC 120 ms
55,880 KB
testcase_21 AC 120 ms
55,872 KB
testcase_22 AC 121 ms
56,276 KB
testcase_23 AC 120 ms
55,416 KB
testcase_24 AC 121 ms
55,908 KB
testcase_25 AC 120 ms
55,640 KB
testcase_26 AC 127 ms
55,928 KB
testcase_27 AC 121 ms
55,972 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package j_25;

import java.util.Scanner;

public class elebe {
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	System.err.print("Aを入力-->");
	int A = sc.nextInt();
	System.err.print("Bを入力-->");
	int B = sc.nextInt();
	System.err.print("Sを入力-->");
	int S = sc.nextInt();
	
	int a = Math.abs(S-A);
	int b = Math.abs(S-B);
	
	if(a > b){//Bが選択された時
		int ans = b + S -1 + A;
		System.out.println(ans);
		System.err.println("Bが選択されました");
	}else if(a < b || a==b){//Aが選択された時
		int ans = a + S;
		System.out.println(ans);
		System.err.println("Aが選択されました");
	}
}
}
0