結果

問題 No.208 王将
ユーザー shinwisteria
提出日時 2017-04-02 12:22:10
言語 Java
(openjdk 23)
結果
AC  
実行時間 113 ms / 1,000 ms
コード長 410 bytes
コンパイル時間 2,588 ms
コンパイル使用メモリ 74,576 KB
実行使用メモリ 54,168 KB
最終ジャッジ日時 2024-07-08 00:00:19
合計ジャッジ時間 6,008 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Ousho {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int x = s.nextInt(),y = s.nextInt(),x2 = s.nextInt(),y2 = s.nextInt();
		s.close();
		int count = 0;
		if(x == y){
			if(x2 == y2 && x > x2){
				count = x+1;
			}else{
				count = x;
			}
		}else{
			count = Math.min(x, y) + Math.abs(x-y);
		}
		System.out.println(count);
	}

}
0