結果

問題 No.149 碁石の移動
ユーザー mits58mits58
提出日時 2016-07-02 18:20:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 2,499 ms
コンパイル使用メモリ 71,152 KB
実行使用メモリ 56,180 KB
最終ジャッジ日時 2023-08-25 17:46:33
合計ジャッジ時間 5,327 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
55,596 KB
testcase_01 AC 108 ms
55,596 KB
testcase_02 AC 110 ms
55,872 KB
testcase_03 AC 107 ms
55,784 KB
testcase_04 AC 110 ms
55,792 KB
testcase_05 AC 112 ms
55,208 KB
testcase_06 AC 111 ms
55,808 KB
testcase_07 AC 109 ms
55,344 KB
testcase_08 AC 110 ms
55,776 KB
testcase_09 AC 109 ms
55,700 KB
testcase_10 AC 110 ms
56,180 KB
testcase_11 AC 109 ms
55,604 KB
testcase_12 AC 108 ms
55,712 KB
testcase_13 AC 116 ms
55,800 KB
testcase_14 AC 113 ms
55,756 KB
testcase_15 AC 106 ms
55,812 KB
testcase_16 AC 110 ms
56,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		while(sc.hasNext()){
			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){
				ab-=c; bb+=c;
			}
			else{
				aw-=(c-ab); bw+=(c-ab);
				bb+=ab; ab=0;
			}
			if(bw>=d) aw+=d;
			else aw+=bw;
			System.out.println(aw);
		}
	}
}
0