結果

問題 No.149 碁石の移動
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-11-13 06:35:38
言語 Java19
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 2,004 ms
コンパイル使用メモリ 71,824 KB
実行使用メモリ 56,324 KB
最終ジャッジ日時 2023-08-25 17:49:04
合計ジャッジ時間 5,181 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,032 KB
testcase_01 AC 116 ms
55,668 KB
testcase_02 AC 108 ms
56,164 KB
testcase_03 AC 108 ms
56,024 KB
testcase_04 AC 111 ms
56,192 KB
testcase_05 AC 114 ms
55,736 KB
testcase_06 AC 109 ms
56,032 KB
testcase_07 AC 108 ms
56,032 KB
testcase_08 AC 118 ms
56,016 KB
testcase_09 AC 114 ms
55,896 KB
testcase_10 AC 115 ms
55,812 KB
testcase_11 AC 113 ms
55,752 KB
testcase_12 AC 109 ms
55,528 KB
testcase_13 AC 110 ms
56,324 KB
testcase_14 AC 119 ms
55,528 KB
testcase_15 AC 124 ms
55,508 KB
testcase_16 AC 121 ms
55,948 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();
        int r;
        
        if(C<=Ab){
            if(D>=Bw){
                r=Aw+Bw;
            }else{
                r=Aw+D;
            }
        }else{
            Aw=Aw-(C-Ab);
            Bw=Bw+(C-Ab);
            Bb=Bb+Ab;
            if(D>=Bw){
                r=Aw+Bw;
            }else{
                r=Aw+D;
            }
        }
        System.out.println(r);
    }
}
0