結果

問題 No.240 ナイト散歩
ユーザー YamaKasaYamaKasa
提出日時 2018-09-05 23:17:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 945 bytes
コンパイル時間 2,510 ms
コンパイル使用メモリ 73,840 KB
実行使用メモリ 56,456 KB
最終ジャッジ日時 2023-08-09 20:07:37
合計ジャッジ時間 8,171 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
55,524 KB
testcase_01 AC 120 ms
55,936 KB
testcase_02 AC 122 ms
53,652 KB
testcase_03 AC 119 ms
56,124 KB
testcase_04 AC 121 ms
55,608 KB
testcase_05 AC 120 ms
55,480 KB
testcase_06 AC 120 ms
55,548 KB
testcase_07 AC 121 ms
55,548 KB
testcase_08 AC 118 ms
55,956 KB
testcase_09 AC 121 ms
55,796 KB
testcase_10 AC 120 ms
55,648 KB
testcase_11 AC 118 ms
56,336 KB
testcase_12 AC 118 ms
55,808 KB
testcase_13 AC 119 ms
55,696 KB
testcase_14 AC 119 ms
55,936 KB
testcase_15 AC 122 ms
55,752 KB
testcase_16 AC 124 ms
55,760 KB
testcase_17 AC 122 ms
54,088 KB
testcase_18 AC 121 ms
55,436 KB
testcase_19 AC 122 ms
55,528 KB
testcase_20 AC 120 ms
55,472 KB
testcase_21 AC 123 ms
55,560 KB
testcase_22 AC 121 ms
55,368 KB
testcase_23 AC 120 ms
55,440 KB
testcase_24 AC 120 ms
55,508 KB
testcase_25 AC 120 ms
55,640 KB
testcase_26 AC 119 ms
55,252 KB
testcase_27 AC 120 ms
55,432 KB
testcase_28 AC 120 ms
55,736 KB
testcase_29 AC 120 ms
55,948 KB
testcase_30 AC 121 ms
55,956 KB
testcase_31 AC 121 ms
55,776 KB
testcase_32 AC 120 ms
56,456 KB
testcase_33 AC 121 ms
55,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	static int []a;
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int X = scan.nextInt();
		int Y = scan.nextInt();
		scan.close();
		if(X == 0 && Y == 0) {
			System.out.println("YES");
			System.exit(0);
		}
		int[] dx = {-2, -2, -1, -1, 1, 1, 2, 2};
		int[] dy = {-1, 1, -2, 2, -2, 2, -1, 1};
		int x = 0;
		int y = 0;
		for(int i = 0; i < 8; i++) {
			x = dx[i];
			y = dy[i];
			if(x == X && y == Y) {
				System.out.println("YES");
				System.exit(0);
			}
			for(int j = 0; j < 8; j++) {
				x = dx[i] + dx[j];
				y = dy[i] + dy[j];
				if(x == X && y == Y) {
					System.out.println("YES");
					System.exit(0);
				}
				for(int k = 0; k < 8; k++) {
					x = dx[i] + dx[j] + dx[k];
					y = dy[i] + dy[j] + dy[k];
					if(x == X && y == Y) {
						System.out.println("YES");
						System.exit(0);
					}
				}
			}
		}
		System.out.println("NO");
	}

}
0