結果

問題 No.126 2基のエレベータ
ユーザー m2543315647m2543315647
提出日時 2015-05-17 17:04:55
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 345 bytes
コンパイル時間 5,386 ms
コンパイル使用メモリ 72,360 KB
実行使用メモリ 40,316 KB
最終ジャッジ日時 2023-09-20 09:26:59
合計ジャッジ時間 8,236 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 122 ms
39,956 KB
testcase_02 AC 121 ms
39,884 KB
testcase_03 AC 120 ms
39,520 KB
testcase_04 AC 118 ms
39,212 KB
testcase_05 AC 119 ms
39,592 KB
testcase_06 AC 122 ms
39,444 KB
testcase_07 AC 123 ms
40,316 KB
testcase_08 AC 120 ms
39,280 KB
testcase_09 AC 123 ms
39,304 KB
testcase_10 AC 125 ms
39,576 KB
testcase_11 AC 125 ms
40,200 KB
testcase_12 AC 126 ms
39,644 KB
testcase_13 AC 121 ms
39,608 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 124 ms
39,576 KB
testcase_19 AC 123 ms
39,248 KB
testcase_20 WA -
testcase_21 AC 122 ms
39,476 KB
testcase_22 AC 123 ms
39,480 KB
testcase_23 AC 122 ms
39,760 KB
testcase_24 AC 123 ms
39,608 KB
testcase_25 AC 122 ms
40,052 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 120 ms
39,688 KB
testcase_29 AC 122 ms
39,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
public class No126 {
	public static void main (String[] args)
	{
		Scanner sc=new Scanner(System.in);
		int a,b,s,count;
		a=sc.nextInt();
		b=sc.nextInt();
		s=sc.nextInt();
		count=0;
		if(a==0){count++;a++;};
		if(a>s)count+=a;
		else count+=Math.min(Math.abs(a-s),Math.abs(b-s))+s;
		System.out.println(count);
	}
}
0