結果

問題 No.208 王将
ユーザー uafr_csuafr_cs
提出日時 2015-05-15 22:41:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 1,000 ms
コード長 629 bytes
コンパイル時間 2,224 ms
コンパイル使用メモリ 74,372 KB
実行使用メモリ 41,768 KB
最終ジャッジ日時 2024-04-17 22:35:35
合計ジャッジ時間 6,591 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
41,768 KB
testcase_01 AC 137 ms
41,392 KB
testcase_02 AC 135 ms
41,276 KB
testcase_03 AC 136 ms
41,292 KB
testcase_04 AC 135 ms
41,424 KB
testcase_05 AC 136 ms
41,412 KB
testcase_06 AC 136 ms
41,124 KB
testcase_07 AC 137 ms
41,260 KB
testcase_08 AC 132 ms
41,520 KB
testcase_09 AC 138 ms
41,248 KB
testcase_10 AC 135 ms
41,404 KB
testcase_11 AC 138 ms
41,580 KB
testcase_12 AC 136 ms
41,536 KB
testcase_13 AC 138 ms
41,108 KB
testcase_14 AC 136 ms
41,088 KB
testcase_15 AC 136 ms
41,144 KB
testcase_16 AC 139 ms
41,372 KB
testcase_17 AC 135 ms
41,384 KB
testcase_18 AC 137 ms
41,408 KB
testcase_19 AC 139 ms
41,520 KB
testcase_20 AC 136 ms
41,264 KB
testcase_21 AC 136 ms
41,300 KB
testcase_22 AC 136 ms
41,544 KB
testcase_23 AC 136 ms
41,148 KB
testcase_24 AC 136 ms
41,272 KB
権限があれば一括ダウンロードができます

ソースコード

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