結果

問題 No.208 王将
ユーザー uafr_csuafr_cs
提出日時 2015-05-15 22:41:13
言語 Java
(openjdk 23)
結果
AC  
実行時間 144 ms / 1,000 ms
コード長 629 bytes
コンパイル時間 2,182 ms
コンパイル使用メモリ 74,440 KB
実行使用メモリ 54,400 KB
最終ジャッジ日時 2024-10-09 16:18:34
合計ジャッジ時間 6,519 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.LinkedList;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		final long x = sc.nextLong();
		final long y = sc.nextLong();
		final long x2 = sc.nextLong();
		final long y2 = sc.nextLong();
		
		final long opt = x + y - Math.min(x, y);
		
		if(x == y && x2 == y2 && x2 < x && y2 < y){
			System.out.println(opt + 1);
		}else if(x == 0 && x2 == 0 && y2 < y){
			System.out.println(opt);
		}else if(y == 0 && y2 == 0 && x2 < x){
			System.out.println(opt);
		}else {
			System.out.println(opt);
		}
	}
	
}
0