結果

問題 No.149 碁石の移動
ユーザー mitsuomitsuo
提出日時 2016-05-05 11:51:43
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 942 bytes
コンパイル時間 2,500 ms
コンパイル使用メモリ 80,376 KB
実行使用メモリ 56,048 KB
最終ジャッジ日時 2023-08-25 17:44:23
合計ジャッジ時間 5,482 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,680 KB
testcase_01 AC 124 ms
55,772 KB
testcase_02 AC 123 ms
55,712 KB
testcase_03 AC 124 ms
55,736 KB
testcase_04 AC 123 ms
55,676 KB
testcase_05 AC 121 ms
55,652 KB
testcase_06 AC 124 ms
55,924 KB
testcase_07 AC 124 ms
55,428 KB
testcase_08 AC 122 ms
55,460 KB
testcase_09 AC 123 ms
55,848 KB
testcase_10 AC 124 ms
55,564 KB
testcase_11 AC 124 ms
55,932 KB
testcase_12 AC 123 ms
55,620 KB
testcase_13 AC 121 ms
55,628 KB
testcase_14 AC 122 ms
56,000 KB
testcase_15 AC 123 ms
55,908 KB
testcase_16 AC 122 ms
56,048 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package jp.fedom.challange.yuki.q149;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	final static String d = System.getProperty("line.separator");

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<String> input = new ArrayList<>();
		while (sc.hasNext()) {
			input.add(sc.nextLine());
		}

		System.out.println(solve(input));

		sc.close();
	}

	public static int solve(List<String> in) {
		Integer Aw = Integer.valueOf(in.get(0).split(" ")[0]);
		Integer Ab = Integer.valueOf(in.get(0).split(" ")[1]);
		Integer Bw = Integer.valueOf(in.get(1).split(" ")[0]);
		Integer Bb = Integer.valueOf(in.get(1).split(" ")[1]);
		Integer C = Integer.valueOf(in.get(2).split(" ")[0]);
		Integer D = Integer.valueOf(in.get(2).split(" ")[1]);

		int mo = Math.min(Ab, C);
		Bw += C - mo;
		Aw -= C - mo;

		mo = Math.min(Bw, D);
		Aw += mo;

		return Aw;

	}

}
0