結果

問題 No.149 碁石の移動
ユーザー 37zigen37zigen
提出日時 2016-03-31 18:21:03
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 499 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 74,064 KB
実行使用メモリ 41,352 KB
最終ジャッジ日時 2024-12-24 03:16:12
合計ジャッジ時間 4,889 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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