結果

問題 No.149 碁石の移動
ユーザー spacia
提出日時 2016-01-03 15:25:12
言語 Java
(openjdk 23)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 735 bytes
コンパイル時間 2,238 ms
コンパイル使用メモリ 74,004 KB
実行使用メモリ 36,828 KB
最終ジャッジ日時 2024-12-24 03:14:25
合計ジャッジ時間 3,397 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
		
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		String[] line1 = br.readLine().split(" ");
		String[] line2 = br.readLine().split(" ");
		String[] line3 = br.readLine().split(" ");
		
		int aw = Integer.parseInt(line1[0]);
		int ab = Integer.parseInt(line1[1]);
		int bw = Integer.parseInt(line2[0]);
		int bb = Integer.parseInt(line2[1]);
		int c  = Integer.parseInt(line3[0]);
		int d  = Integer.parseInt(line3[1]);
		
		if (c > ab) {
			c -= ab;
			aw -= c;
			bw += c;
		}
		
		out(aw + Math.min(d , bw));
	}
}
0