結果

問題 No.149 碁石の移動
ユーザー mits58
提出日時 2016-07-02 18:20:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 457 bytes
コンパイル時間 2,508 ms
コンパイル使用メモリ 74,652 KB
実行使用メモリ 41,272 KB
最終ジャッジ日時 2024-12-24 03:19:19
合計ジャッジ時間 5,112 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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