結果

問題 No.149 碁石の移動
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 06:32:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 2,022 ms
コンパイル使用メモリ 72,040 KB
実行使用メモリ 56,080 KB
最終ジャッジ日時 2023-08-17 04:10:03
合計ジャッジ時間 5,412 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
55,868 KB
testcase_01 AC 120 ms
55,892 KB
testcase_02 WA -
testcase_03 AC 123 ms
55,748 KB
testcase_04 AC 126 ms
55,688 KB
testcase_05 AC 123 ms
55,808 KB
testcase_06 AC 123 ms
55,740 KB
testcase_07 AC 123 ms
55,712 KB
testcase_08 AC 123 ms
55,908 KB
testcase_09 AC 120 ms
55,676 KB
testcase_10 AC 131 ms
55,700 KB
testcase_11 AC 123 ms
55,968 KB
testcase_12 AC 123 ms
55,544 KB
testcase_13 AC 125 ms
55,608 KB
testcase_14 WA -
testcase_15 AC 126 ms
55,732 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

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();
        int r;
        
        if(C<=Ab){
            if(D>=Bw){
                r=Aw+Bw;
            }else{
                r=Aw+D;
            }
        }else{
            Aw=Aw-(C-Ab);
            Ab=0;
            Bw=Bw+(C-Ab);
            Bb=Bb+Ab;
            if(D>=Bw){
                r=Aw+Bw;
            }else{
                r=Aw+D;
            }
        }
        System.out.println(r);
    }
}
0