結果

問題 No.126 2基のエレベータ
ユーザー kanra661
提出日時 2015-01-13 23:41:37
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 3,704 ms
コンパイル使用メモリ 77,592 KB
実行使用メモリ 56,208 KB
最終ジャッジ日時 2024-06-22 05:33:15
合計ジャッジ時間 7,518 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13 WA * 14
権限があれば一括ダウンロードができます

ソースコード

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