結果

問題 No.149 碁石の移動
ユーザー koukonkokoukonko
提出日時 2015-12-13 00:45:37
言語 Java21
(openjdk 21)
結果
AC  
実行時間 40 ms / 2,000 ms
コード長 844 bytes
コンパイル時間 1,879 ms
コンパイル使用メモリ 73,844 KB
実行使用メモリ 49,904 KB
最終ジャッジ日時 2023-08-25 17:41:32
合計ジャッジ時間 3,485 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
49,344 KB
testcase_01 AC 38 ms
49,236 KB
testcase_02 AC 40 ms
49,332 KB
testcase_03 AC 38 ms
49,260 KB
testcase_04 AC 38 ms
49,400 KB
testcase_05 AC 39 ms
49,204 KB
testcase_06 AC 38 ms
49,212 KB
testcase_07 AC 38 ms
49,416 KB
testcase_08 AC 37 ms
49,144 KB
testcase_09 AC 38 ms
49,412 KB
testcase_10 AC 38 ms
49,904 KB
testcase_11 AC 36 ms
49,664 KB
testcase_12 AC 37 ms
49,408 KB
testcase_13 AC 37 ms
49,672 KB
testcase_14 AC 37 ms
49,424 KB
testcase_15 AC 38 ms
49,320 KB
testcase_16 AC 38 ms
49,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
		try {
			String[] abox = read.readLine().split(" ");
			String[] bbox = read.readLine().split(" ");
			String[] cbox = read.readLine().split(" ");
			int[] a = new int[2];
			int[] b = new int[2];
			int[] c = new int[2];

			for (int i = 0; i < 2; ++i) {
				a[i] = Integer.parseInt(abox[i]);
				b[i] = Integer.parseInt(bbox[i]);
				c[i] = Integer.parseInt(cbox[i]);
			}

			if (a[1] - c[0] < 0) {
				b[0] += Math.abs(a[1] - c[0]);
				a[0] += a[1] - c[0];
			}

			if (b[0] - c[1] < 0) {
				a[0] += b[0];
			} else {
				a[0] += c[1];
			}

			System.out.println(a[0]);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
0