結果

問題 No.149 碁石の移動
ユーザー ぴろずぴろず
提出日時 2015-02-12 23:26:41
言語 Java21
(openjdk 21)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 3,991 ms
コンパイル使用メモリ 72,340 KB
実行使用メモリ 56,136 KB
最終ジャッジ日時 2023-08-25 17:19:04
合計ジャッジ時間 5,096 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,996 KB
testcase_01 AC 121 ms
55,452 KB
testcase_02 AC 121 ms
55,940 KB
testcase_03 AC 121 ms
55,680 KB
testcase_04 AC 120 ms
55,584 KB
testcase_05 AC 120 ms
55,480 KB
testcase_06 AC 121 ms
55,896 KB
testcase_07 AC 122 ms
55,332 KB
testcase_08 AC 122 ms
56,136 KB
testcase_09 AC 121 ms
55,340 KB
testcase_10 AC 122 ms
56,112 KB
testcase_11 AC 120 ms
55,292 KB
testcase_12 AC 122 ms
55,984 KB
testcase_13 AC 121 ms
55,896 KB
testcase_14 AC 122 ms
55,616 KB
testcase_15 AC 121 ms
55,692 KB
testcase_16 AC 123 ms
53,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no149;

import java.util.Scanner;

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 db = Math.min(ab, c);
		aw -= (c - db);
		bw += (c - db);
		ab -= db;
		bb += db;

		int dw = Math.min(bw, d);
		bw -= dw;
		aw += dw;
		System.out.println(aw);
	}

}
0