結果

問題 No.126 2基のエレベータ
ユーザー kanra661kanra661
提出日時 2015-01-14 00:07:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 5,183 ms
コンパイル使用メモリ 72,140 KB
実行使用メモリ 56,272 KB
最終ジャッジ日時 2023-09-04 06:28:22
合計ジャッジ時間 8,806 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,760 KB
testcase_01 AC 123 ms
56,016 KB
testcase_02 WA -
testcase_03 AC 122 ms
55,820 KB
testcase_04 AC 123 ms
55,408 KB
testcase_05 AC 123 ms
55,596 KB
testcase_06 AC 123 ms
55,940 KB
testcase_07 AC 122 ms
55,936 KB
testcase_08 AC 123 ms
55,776 KB
testcase_09 AC 123 ms
55,656 KB
testcase_10 AC 123 ms
55,540 KB
testcase_11 AC 122 ms
55,556 KB
testcase_12 AC 123 ms
55,688 KB
testcase_13 AC 125 ms
55,756 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 123 ms
55,744 KB
testcase_17 WA -
testcase_18 AC 122 ms
55,920 KB
testcase_19 AC 124 ms
56,092 KB
testcase_20 WA -
testcase_21 AC 122 ms
55,804 KB
testcase_22 AC 123 ms
56,008 KB
testcase_23 AC 122 ms
53,984 KB
testcase_24 AC 122 ms
56,012 KB
testcase_25 AC 120 ms
55,632 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 121 ms
55,692 KB
testcase_29 AC 121 ms
55,548 KB
権限があれば一括ダウンロードができます

ソースコード

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();
		int move = 0;
		sc.close();

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

}
0