結果

問題 No.149 碁石の移動
ユーザー kenji_shioyakenji_shioya
提出日時 2016-06-24 01:08:22
言語 Java21
(openjdk 21)
結果
AC  
実行時間 120 ms / 2,000 ms
コード長 513 bytes
コンパイル時間 3,372 ms
コンパイル使用メモリ 73,236 KB
実行使用メモリ 58,280 KB
最終ジャッジ日時 2023-08-25 17:44:45
合計ジャッジ時間 5,955 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,188 KB
testcase_01 AC 119 ms
56,148 KB
testcase_02 AC 120 ms
55,996 KB
testcase_03 AC 120 ms
56,108 KB
testcase_04 AC 119 ms
56,168 KB
testcase_05 AC 120 ms
56,408 KB
testcase_06 AC 118 ms
56,200 KB
testcase_07 AC 117 ms
55,820 KB
testcase_08 AC 119 ms
55,820 KB
testcase_09 AC 119 ms
55,704 KB
testcase_10 AC 118 ms
55,692 KB
testcase_11 AC 119 ms
56,036 KB
testcase_12 AC 119 ms
56,268 KB
testcase_13 AC 118 ms
55,664 KB
testcase_14 AC 119 ms
56,008 KB
testcase_15 AC 119 ms
55,972 KB
testcase_16 AC 120 ms
58,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Exercise118{
  public static void main (String[] args){

    Scanner sc = new Scanner(System.in);

    int[] a = new int[2];
    int[] b = new int[2];
    a[0] = sc.nextInt();
    a[1] = sc.nextInt();
    b[0] = sc.nextInt();
    b[1] = sc.nextInt();
    int f = sc.nextInt();
    int s = sc.nextInt();
    b[0] += Math.min((a[1] > f) ? 0 : f - a[1], a[0]);
    a[0] -= Math.min((a[1] > f) ? 0 : f - a[1], a[0]);
    a[0] += Math.min(s, b[0]);
    System.out.println(a[0]);
  }
}
0