結果

問題 No.149 碁石の移動
ユーザー tentententen
提出日時 2020-10-09 14:05:19
言語 Java21
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 2,912 ms
コンパイル使用メモリ 71,420 KB
実行使用メモリ 56,616 KB
最終ジャッジ日時 2023-09-27 12:40:11
合計ジャッジ時間 5,944 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 104 ms
55,780 KB
testcase_01 AC 103 ms
56,052 KB
testcase_02 AC 104 ms
56,108 KB
testcase_03 AC 105 ms
56,004 KB
testcase_04 AC 108 ms
56,020 KB
testcase_05 AC 103 ms
55,372 KB
testcase_06 AC 105 ms
55,688 KB
testcase_07 AC 104 ms
55,736 KB
testcase_08 AC 105 ms
55,592 KB
testcase_09 AC 105 ms
53,952 KB
testcase_10 AC 106 ms
56,132 KB
testcase_11 AC 106 ms
53,644 KB
testcase_12 AC 127 ms
55,864 KB
testcase_13 AC 102 ms
56,616 KB
testcase_14 AC 105 ms
55,988 KB
testcase_15 AC 103 ms
55,640 KB
testcase_16 AC 101 ms
56,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int aw = sc.nextInt();
        int ab = sc.nextInt();
        int bw = sc.nextInt();
        int bb = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        if (c <= ab) {
            ab -= c;
            bb += c;
        } else {
            int t = c - ab;
            bb += ab;
            ab = 0;
            aw -= t;
            bw += t;
        }
        if (d <= bw) {
            aw += d;
        } else {
            aw += bw;
        }
        System.out.println(aw);
    }
}
0