結果

問題 No.149 碁石の移動
ユーザー yagi2yagi2
提出日時 2017-04-24 17:46:26
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 587 bytes
コンパイル時間 2,222 ms
コンパイル使用メモリ 71,400 KB
実行使用メモリ 56,316 KB
最終ジャッジ日時 2023-08-25 17:51:15
合計ジャッジ時間 5,005 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 103 ms
56,124 KB
testcase_03 AC 108 ms
55,596 KB
testcase_04 AC 104 ms
53,596 KB
testcase_05 AC 107 ms
55,916 KB
testcase_06 AC 106 ms
54,156 KB
testcase_07 AC 103 ms
55,796 KB
testcase_08 AC 108 ms
55,884 KB
testcase_09 AC 106 ms
56,032 KB
testcase_10 AC 110 ms
56,052 KB
testcase_11 AC 110 ms
55,696 KB
testcase_12 AC 117 ms
55,668 KB
testcase_13 AC 111 ms
56,316 KB
testcase_14 AC 107 ms
55,692 KB
testcase_15 AC 102 ms
55,404 KB
testcase_16 AC 109 ms
55,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int Aw = Integer.parseInt(sc.next());
        int Ab = Integer.parseInt(sc.next());
        int Bw = Integer.parseInt(sc.next());
        int Bb = Integer.parseInt(sc.next());

        int C = Integer.parseInt(sc.next());
        int D = Integer.parseInt(sc.next());

        if (Aw+Ab < C*2) {
            Aw -= C - Ab;
            Bw += C - Ab;
        }

        int move = (D > Bw)? Bw : D;

        System.out.println(Aw+move);
    }
}
0