結果

問題 No.208 王将
ユーザー villachvillach
提出日時 2017-10-11 10:31:35
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 3,674 ms
コンパイル使用メモリ 75,036 KB
実行使用メモリ 55,992 KB
最終ジャッジ日時 2024-04-28 15:52:04
合計ジャッジ時間 6,787 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
52,776 KB
testcase_01 AC 105 ms
53,088 KB
testcase_02 AC 115 ms
54,140 KB
testcase_03 AC 102 ms
52,804 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 104 ms
52,968 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 109 ms
53,832 KB
testcase_16 AC 113 ms
53,920 KB
testcase_17 AC 98 ms
52,476 KB
testcase_18 WA -
testcase_19 AC 97 ms
52,420 KB
testcase_20 AC 111 ms
53,600 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class N208 {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int hx = sc.nextInt();
		int hy = sc.nextInt();
		int ななめ = Math.min(Math.abs(x), Math.abs(y));
		int step;
		if(hx == hy && Math.abs(hx) <= ななめ){
			step = 2;
		}else if(Math.abs(hx) > ななめ || Math.abs(hy) > ななめ){
			step = 1;
		}else{
			step = 0;
		}
		System.out.println(Math.max(x, y) + step);
		
	}
}
0