結果

問題 No.208 王将
ユーザー ぴろず
提出日時 2015-05-15 22:29:07
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 2,094 ms
コンパイル使用メモリ 73,792 KB
実行使用メモリ 41,600 KB
最終ジャッジ日時 2024-07-06 04:02:16
合計ジャッジ時間 5,434 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 21 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

package no208;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();

		if (!jama(x,y,x2,y2)) {
			System.out.println(Math.max(Math.abs(x), Math.abs(y)));
		}else{
			System.out.println(Math.max(Math.abs(x), Math.abs(y)) + 1);
		}
	}

	public static boolean jama(int x,int y,int x2,int y2) {
		if (Math.abs(x) != Math.abs(y)) {
			return false;
		}
		if (Math.abs(x2) != Math.abs(y2)) {
			return false;
		}
		return x * x2 >= 0 && y * y2 >= 0;
	}

}
0