結果

問題 No.240 ナイト散歩
ユーザー tenten
提出日時 2020-10-15 08:55:04
言語 Java
(openjdk 23)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 711 bytes
コンパイル時間 2,364 ms
コンパイル使用メモリ 74,744 KB
実行使用メモリ 41,280 KB
最終ジャッジ日時 2024-07-20 19:40:51
合計ジャッジ時間 8,309 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
    	Scanner sc = new Scanner(System.in);
    	int x = sc.nextInt();
    	int y = sc.nextInt();
    	int[] xArr = new int[]{-2, -2, 2, 2, -1, -1, 1, 1};
    	int[] yArr = new int[]{-1, 1, -1, 1, -2, 2, -2, 2};
    	for (int i = 0; i < 8 * 8 * 8; i++) {
    	    int key = i;
    	    int xx = 0;
    	    int yy = 0;
    	    for (int j = 0; j < 3; j++) {
    	        xx += xArr[key % 8];
    	        yy += yArr[key % 8];
    	        key /= 8;
         	    if (xx == x && yy == y) {
        	        System.out.println("YES");
        	        return;
        	    }
   	        }
    	}
    	System.out.println("NO");
	}
}
0