結果

問題 No.149 碁石の移動
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-22 16:16:02
言語 Java21
(openjdk 21)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 419 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 71,076 KB
実行使用メモリ 56,160 KB
最終ジャッジ日時 2023-08-25 17:53:22
合計ジャッジ時間 4,772 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,104 KB
testcase_01 AC 118 ms
55,844 KB
testcase_02 AC 118 ms
55,272 KB
testcase_03 AC 118 ms
56,160 KB
testcase_04 AC 117 ms
55,508 KB
testcase_05 AC 117 ms
55,844 KB
testcase_06 AC 118 ms
55,244 KB
testcase_07 AC 117 ms
55,556 KB
testcase_08 AC 117 ms
55,804 KB
testcase_09 AC 119 ms
55,464 KB
testcase_10 AC 118 ms
55,616 KB
testcase_11 AC 117 ms
55,608 KB
testcase_12 AC 117 ms
56,012 KB
testcase_13 AC 116 ms
55,748 KB
testcase_14 AC 117 ms
55,524 KB
testcase_15 AC 121 ms
55,284 KB
testcase_16 AC 119 ms
55,832 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 ans = aw;
    ans -= Math.max(0, c - ab);
    ans += Math.min(bw + Math.max(0, c - ab), d);
    System.out.println(ans);
  }
}
0