結果

問題 No.149 碁石の移動
ユーザー nCk_cvnCk_cv
提出日時 2016-01-20 17:27:00
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 530 bytes
コンパイル時間 2,110 ms
コンパイル使用メモリ 71,816 KB
実行使用メモリ 56,456 KB
最終ジャッジ日時 2023-08-25 17:42:32
合計ジャッジ時間 4,607 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,524 KB
testcase_01 AC 123 ms
55,828 KB
testcase_02 AC 123 ms
56,028 KB
testcase_03 AC 121 ms
55,788 KB
testcase_04 AC 124 ms
55,852 KB
testcase_05 AC 124 ms
56,004 KB
testcase_06 AC 122 ms
55,476 KB
testcase_07 AC 111 ms
56,456 KB
testcase_08 AC 115 ms
55,900 KB
testcase_09 AC 115 ms
56,336 KB
testcase_10 AC 105 ms
55,776 KB
testcase_11 AC 107 ms
55,924 KB
testcase_12 AC 111 ms
55,904 KB
testcase_13 AC 111 ms
56,060 KB
testcase_14 AC 107 ms
56,128 KB
testcase_15 AC 111 ms
55,804 KB
testcase_16 AC 109 ms
55,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.math.*;
import java.io.*;
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();
		if(ab >= c) {
			bb += c;
			ab -= c;
		}
		else {
			bb += ab;
			bw += (c - ab);
			aw -= (c - ab);
			ab = 0;
			
		}
		if(bw >= d) {
			aw += d;
			bw -= d;
		}
		else {
			aw += bw;
		}
		System.out.println(aw);
	}
 }
0