結果

問題 No.149 碁石の移動
ユーザー nCk_cv
提出日時 2016-01-20 17:27:00
言語 Java
(openjdk 23)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 530 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 73,536 KB
実行使用メモリ 41,288 KB
最終ジャッジ日時 2024-12-24 03:14:42
合計ジャッジ時間 5,545 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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