結果

問題 No.149 碁石の移動
ユーザー haruki_57haruki_57
提出日時 2015-02-14 12:12:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 613 bytes
コンパイル時間 3,035 ms
コンパイル使用メモリ 71,860 KB
実行使用メモリ 56,268 KB
最終ジャッジ日時 2023-08-25 17:24:28
合計ジャッジ時間 6,068 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
56,240 KB
testcase_01 AC 126 ms
56,052 KB
testcase_02 AC 123 ms
55,804 KB
testcase_03 AC 123 ms
55,936 KB
testcase_04 AC 125 ms
55,976 KB
testcase_05 AC 120 ms
55,848 KB
testcase_06 AC 122 ms
56,056 KB
testcase_07 AC 121 ms
56,268 KB
testcase_08 AC 121 ms
55,760 KB
testcase_09 AC 119 ms
55,544 KB
testcase_10 AC 120 ms
55,508 KB
testcase_11 AC 120 ms
55,744 KB
testcase_12 AC 121 ms
56,000 KB
testcase_13 AC 121 ms
55,868 KB
testcase_14 AC 122 ms
56,048 KB
testcase_15 AC 117 ms
56,056 KB
testcase_16 AC 120 ms
55,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class GO {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int aw,ab,bw,bb,c,d;
        aw = sc.nextInt();
        ab = sc.nextInt();
        bw = sc.nextInt();
        bb = sc.nextInt();
        c = sc.nextInt();
        d = sc.nextInt();
        if(ab >= c){
            ab -= c;
            bb += c;
        } else {
            aw -= (c-ab);
            bw += (c-ab);
            bb += ab;
            ab = 0;
        }
        
        System.out.println(aw + Math.min(d, bw));
    }

}
0