結果

問題 No.149 碁石の移動
ユーザー kohaku_kohaku
提出日時 2016-11-13 06:32:09
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 724 bytes
コンパイル時間 1,884 ms
コンパイル使用メモリ 73,944 KB
実行使用メモリ 41,472 KB
最終ジャッジ日時 2024-11-25 21:47:29
合計ジャッジ時間 4,685 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 11 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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