結果

問題 No.126 2基のエレベータ
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-21 17:05:27
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 553 bytes
コンパイル時間 1,926 ms
コンパイル使用メモリ 71,728 KB
実行使用メモリ 56,580 KB
最終ジャッジ日時 2023-08-18 06:10:20
合計ジャッジ時間 7,129 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 121 ms
55,764 KB
testcase_02 AC 122 ms
55,976 KB
testcase_03 AC 119 ms
55,648 KB
testcase_04 AC 118 ms
55,884 KB
testcase_05 AC 119 ms
55,924 KB
testcase_06 AC 118 ms
56,120 KB
testcase_07 AC 117 ms
55,424 KB
testcase_08 AC 119 ms
56,280 KB
testcase_09 AC 121 ms
55,652 KB
testcase_10 AC 120 ms
56,456 KB
testcase_11 AC 119 ms
55,908 KB
testcase_12 AC 117 ms
56,120 KB
testcase_13 AC 117 ms
55,600 KB
testcase_14 AC 118 ms
55,648 KB
testcase_15 AC 116 ms
56,344 KB
testcase_16 WA -
testcase_17 AC 120 ms
55,932 KB
testcase_18 AC 118 ms
55,648 KB
testcase_19 AC 118 ms
55,436 KB
testcase_20 AC 120 ms
55,888 KB
testcase_21 AC 119 ms
55,916 KB
testcase_22 AC 118 ms
55,496 KB
testcase_23 AC 128 ms
55,656 KB
testcase_24 AC 118 ms
56,132 KB
testcase_25 AC 117 ms
53,660 KB
testcase_26 AC 118 ms
56,100 KB
testcase_27 AC 117 ms
55,840 KB
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int S = sc.nextInt();
        int min=0;
        int Amove=Math.abs(A-S);
        int Bmove=Math.abs(B-S);
        if(S==1){
            min+=Amove+1;
        }else{
            if(Amove<=Bmove){
                min+=Amove+S;
            }else{
                min+=Bmove+S+Math.abs(A-1);
            }
        }
        System.out.println(min);
    }
}
0