結果

問題 No.149 碁石の移動
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 06:32:09
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 1,824 ms
コンパイル使用メモリ 74,652 KB
実行使用メモリ 41,396 KB
最終ジャッジ日時 2024-05-04 11:17:06
合計ジャッジ時間 4,560 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 99 ms
40,160 KB
testcase_01 AC 106 ms
40,232 KB
testcase_02 WA -
testcase_03 AC 107 ms
41,192 KB
testcase_04 AC 107 ms
41,248 KB
testcase_05 AC 107 ms
41,396 KB
testcase_06 AC 111 ms
41,236 KB
testcase_07 AC 94 ms
39,908 KB
testcase_08 AC 111 ms
41,316 KB
testcase_09 AC 101 ms
40,340 KB
testcase_10 AC 119 ms
41,068 KB
testcase_11 AC 122 ms
41,304 KB
testcase_12 AC 112 ms
41,112 KB
testcase_13 AC 100 ms
40,292 KB
testcase_14 WA -
testcase_15 AC 107 ms
41,188 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