結果

問題 No.149 碁石の移動
ユーザー 37zigen37zigen
提出日時 2016-03-31 18:21:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 1,868 ms
コンパイル使用メモリ 71,204 KB
実行使用メモリ 56,176 KB
最終ジャッジ日時 2023-08-25 17:43:38
合計ジャッジ時間 4,939 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,172 KB
testcase_01 AC 129 ms
55,484 KB
testcase_02 AC 126 ms
56,120 KB
testcase_03 AC 124 ms
55,760 KB
testcase_04 AC 124 ms
55,672 KB
testcase_05 AC 123 ms
56,176 KB
testcase_06 AC 121 ms
55,756 KB
testcase_07 AC 123 ms
55,932 KB
testcase_08 AC 121 ms
55,564 KB
testcase_09 AC 123 ms
55,844 KB
testcase_10 AC 123 ms
55,816 KB
testcase_11 AC 121 ms
55,680 KB
testcase_12 AC 121 ms
55,900 KB
testcase_13 AC 124 ms
56,044 KB
testcase_14 AC 123 ms
55,640 KB
testcase_15 AC 123 ms
55,680 KB
testcase_16 AC 122 ms
55,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder149;
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();
		
		//1回目
		if(c<=ab){
			ab-=c;
			bb+=c;
		}else if(c>ab){
			bb+=ab;
			aw-=c-ab;
			bw+=c-ab;
			ab=0;
		}
		//2回目
		if(d>bw){
			System.out.println(aw+bw);
		}else{
			System.out.println(aw+d);
		}
	}
}
0