結果

問題 No.149 碁石の移動
ユーザー dazy
提出日時 2016-09-21 17:07:32
言語 Java
(openjdk 23)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 660 bytes
コンパイル時間 3,253 ms
コンパイル使用メモリ 76,432 KB
実行使用メモリ 41,408 KB
最終ジャッジ日時 2024-12-24 03:20:57
合計ジャッジ時間 5,664 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Run {
    final static int M = 1000000007;
    public static void main (String arg[]) {
        Scanner scan = new Scanner(System.in);
        int Aw,Ab,Bw,Bb,C,D;
        Aw = scan.nextInt();
        Ab = scan.nextInt();
        Bw = scan.nextInt();
        Bb = scan.nextInt();
        C = scan.nextInt();
        D = scan.nextInt();
        int r;
        if (Ab < C) {
            r = C - Ab;
            Aw -= r;
            Bw += r;
            if (Bw > D) Aw += D;
            else Aw += Bw;
        } else {
            if (Bw > D) Aw += D;
            else Aw += Bw;
        }
        System.out.println(Aw);
    }
}
0