結果

問題 No.149 碁石の移動
ユーザー htensaihtensai
提出日時 2019-11-30 10:05:55
言語 Java19
(openjdk 21)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 2,031 ms
コンパイル使用メモリ 74,380 KB
実行使用メモリ 57,640 KB
最終ジャッジ日時 2023-08-13 08:05:56
合計ジャッジ時間 5,205 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,368 KB
testcase_01 AC 116 ms
56,116 KB
testcase_02 AC 120 ms
56,024 KB
testcase_03 AC 119 ms
55,764 KB
testcase_04 AC 119 ms
57,640 KB
testcase_05 AC 121 ms
55,596 KB
testcase_06 AC 120 ms
55,768 KB
testcase_07 AC 119 ms
56,364 KB
testcase_08 AC 119 ms
56,456 KB
testcase_09 AC 119 ms
55,868 KB
testcase_10 AC 116 ms
56,232 KB
testcase_11 AC 118 ms
55,832 KB
testcase_12 AC 122 ms
55,816 KB
testcase_13 AC 121 ms
55,820 KB
testcase_14 AC 121 ms
55,540 KB
testcase_15 AC 122 ms
56,140 KB
testcase_16 AC 122 ms
55,772 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();
		bw += Math.max(c - ab, 0);
		aw -= Math.max(c - ab, 0);
		bb += Math.min(ab, c);
		aw += Math.min(d, bw);
		System.out.println(aw);
	}
}
0