結果

問題 No.208 王将
ユーザー ぴろずぴろず
提出日時 2015-05-15 22:29:07
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 625 bytes
コンパイル時間 2,992 ms
コンパイル使用メモリ 71,188 KB
実行使用メモリ 56,124 KB
最終ジャッジ日時 2023-09-20 08:15:28
合計ジャッジ時間 6,667 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
55,904 KB
testcase_01 AC 126 ms
55,832 KB
testcase_02 AC 126 ms
55,616 KB
testcase_03 AC 127 ms
55,660 KB
testcase_04 AC 126 ms
55,632 KB
testcase_05 AC 127 ms
55,624 KB
testcase_06 WA -
testcase_07 AC 127 ms
55,708 KB
testcase_08 AC 127 ms
55,604 KB
testcase_09 AC 127 ms
55,720 KB
testcase_10 AC 128 ms
55,364 KB
testcase_11 AC 124 ms
55,660 KB
testcase_12 AC 124 ms
55,896 KB
testcase_13 AC 127 ms
55,728 KB
testcase_14 AC 128 ms
56,124 KB
testcase_15 AC 125 ms
55,552 KB
testcase_16 AC 127 ms
55,884 KB
testcase_17 AC 131 ms
55,668 KB
testcase_18 AC 128 ms
55,812 KB
testcase_19 AC 127 ms
55,528 KB
testcase_20 AC 127 ms
55,736 KB
testcase_21 AC 127 ms
55,628 KB
testcase_22 AC 126 ms
55,928 KB
testcase_23 AC 129 ms
55,704 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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