結果

問題 No.149 碁石の移動
ユーザー fkwnw3_1243fkwnw3_1243
提出日時 2017-04-29 20:15:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 982 bytes
コンパイル時間 3,911 ms
コンパイル使用メモリ 71,244 KB
実行使用メモリ 49,316 KB
最終ジャッジ日時 2023-08-25 17:51:24
合計ジャッジ時間 3,797 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,020 KB
testcase_01 AC 43 ms
48,952 KB
testcase_02 AC 43 ms
49,268 KB
testcase_03 AC 43 ms
48,944 KB
testcase_04 AC 43 ms
48,908 KB
testcase_05 AC 43 ms
48,908 KB
testcase_06 AC 42 ms
48,884 KB
testcase_07 AC 43 ms
49,124 KB
testcase_08 AC 43 ms
48,948 KB
testcase_09 AC 43 ms
49,316 KB
testcase_10 AC 42 ms
49,212 KB
testcase_11 AC 43 ms
49,032 KB
testcase_12 AC 43 ms
49,116 KB
testcase_13 AC 43 ms
48,992 KB
testcase_14 AC 43 ms
49,096 KB
testcase_15 AC 43 ms
49,004 KB
testcase_16 AC 43 ms
49,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;

import static java.lang.System.in;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] inputs = reader.readLine().split(" ");
        int aw = Integer.parseInt(inputs[0]);
        int ab = Integer.parseInt(inputs[1]);
        inputs = reader.readLine().split(" ");
        int bw = Integer.parseInt(inputs[0]);
        int bb = Integer.parseInt(inputs[1]);
        inputs = reader.readLine().split(" ");
        int c = Integer.parseInt(inputs[0]);
        int d = Integer.parseInt(inputs[1]);


        if (ab < c) {
            aw = aw - (c - ab);
            bw = bw + (c-ab);
        }

        if (bw < d) {
            aw = aw + bw;
        } else {
            aw = aw + d;
        }

        System.out.println(aw);


    }
}
0