結果

問題 No.240 ナイト散歩
ユーザー YamaKasaYamaKasa
提出日時 2018-09-05 23:17:36
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 2,000 ms
コード長 945 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 77,784 KB
実行使用メモリ 54,528 KB
最終ジャッジ日時 2024-04-27 14:39:48
合計ジャッジ時間 7,808 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 131 ms
54,116 KB
testcase_01 AC 132 ms
54,132 KB
testcase_02 AC 136 ms
54,500 KB
testcase_03 AC 134 ms
54,236 KB
testcase_04 AC 140 ms
54,140 KB
testcase_05 AC 138 ms
54,320 KB
testcase_06 AC 134 ms
54,100 KB
testcase_07 AC 139 ms
54,296 KB
testcase_08 AC 129 ms
53,776 KB
testcase_09 AC 131 ms
54,312 KB
testcase_10 AC 132 ms
54,240 KB
testcase_11 AC 128 ms
53,956 KB
testcase_12 AC 135 ms
54,032 KB
testcase_13 AC 133 ms
54,200 KB
testcase_14 AC 131 ms
54,036 KB
testcase_15 AC 135 ms
54,360 KB
testcase_16 AC 130 ms
54,068 KB
testcase_17 AC 132 ms
54,284 KB
testcase_18 AC 139 ms
54,272 KB
testcase_19 AC 139 ms
54,236 KB
testcase_20 AC 140 ms
54,528 KB
testcase_21 AC 138 ms
54,216 KB
testcase_22 AC 144 ms
54,276 KB
testcase_23 AC 143 ms
54,128 KB
testcase_24 AC 144 ms
54,328 KB
testcase_25 AC 139 ms
54,216 KB
testcase_26 AC 146 ms
54,448 KB
testcase_27 AC 142 ms
54,312 KB
testcase_28 AC 134 ms
54,300 KB
testcase_29 AC 131 ms
54,388 KB
testcase_30 AC 132 ms
54,080 KB
testcase_31 AC 135 ms
54,256 KB
testcase_32 AC 132 ms
54,008 KB
testcase_33 AC 136 ms
53,972 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