結果

問題 No.240 ナイト散歩
ユーザー mastersatoshimastersatoshi
提出日時 2015-07-16 16:10:47
言語 Java21
(openjdk 21)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 2,325 bytes
コンパイル時間 2,355 ms
コンパイル使用メモリ 76,480 KB
実行使用メモリ 37,412 KB
最終ジャッジ日時 2024-04-16 19:31:34
合計ジャッジ時間 5,005 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
37,132 KB
testcase_01 AC 53 ms
36,932 KB
testcase_02 AC 54 ms
36,896 KB
testcase_03 AC 55 ms
37,184 KB
testcase_04 AC 53 ms
37,060 KB
testcase_05 AC 53 ms
37,328 KB
testcase_06 AC 54 ms
37,156 KB
testcase_07 AC 54 ms
37,284 KB
testcase_08 AC 54 ms
36,988 KB
testcase_09 AC 53 ms
37,412 KB
testcase_10 AC 53 ms
37,040 KB
testcase_11 AC 54 ms
36,864 KB
testcase_12 AC 54 ms
37,324 KB
testcase_13 AC 54 ms
37,296 KB
testcase_14 AC 54 ms
37,228 KB
testcase_15 AC 54 ms
36,928 KB
testcase_16 AC 54 ms
37,268 KB
testcase_17 AC 54 ms
37,308 KB
testcase_18 AC 54 ms
37,232 KB
testcase_19 AC 54 ms
37,164 KB
testcase_20 AC 55 ms
37,220 KB
testcase_21 AC 55 ms
37,284 KB
testcase_22 AC 53 ms
36,684 KB
testcase_23 AC 53 ms
37,180 KB
testcase_24 AC 53 ms
37,212 KB
testcase_25 AC 54 ms
37,188 KB
testcase_26 AC 54 ms
37,156 KB
testcase_27 AC 53 ms
37,320 KB
testcase_28 AC 56 ms
37,216 KB
testcase_29 AC 54 ms
36,688 KB
testcase_30 AC 54 ms
36,996 KB
testcase_31 AC 53 ms
36,816 KB
testcase_32 AC 53 ms
36,904 KB
testcase_33 AC 53 ms
37,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    //取りうる座標を全て定数化しておく
    private static final int dest[][] = new int[][]{{-6, -3},
    {-6, -1},
    {-6, 1},
    {-6, 3},
    {-5, -4},
    {-5, -2},
    {-5, 0},
    {-5, 2},
    {-5, 4},
    {-4, -5},
    {-4, -3},
    {-4, -2},
    {-4, -1},
    {-4, 0},
    {-4, 1},
    {-4, 2},
    {-4, 3},
    {-4, 5},
    {-3, -6},
    {-3, -4},
    {-3, -3},
    {-3, -2},
    {-3, -1},
    {-3, 0},
    {-3, 1},
    {-3, 2},
    {-3, 3},
    {-3, 4},
    {-3, 6},
    {-2, -5},
    {-2, -4},
    {-2, -3},
    {-2, -1},
    {-2, 0},
    {-2, 1},
    {-2, 3},
    {-2, 4},
    {-2, 5},
    {-1, -6},
    {-1, -4},
    {-1, -3},
    {-1, -2},
    {-1, -1},
    {-1, 0},
    {-1, 1},
    {-1, 2},
    {-1, 3},
    {-1, 4},
    {-1, 6},
    {0, -5},
    {0, -4},
    {0, -3},
    {0, -2},
    {0, -1},
    {0, 0},
    {0, 1},
    {0, 2},
    {0, 3},
    {0, 4},
    {0, 5},
    {1, -6},
    {1, -4},
    {1, -3},
    {1, -2},
    {1, -1},
    {1, 0},
    {1, 1},
    {1, 2},
    {1, 3},
    {1, 4},
    {1, 6},
    {2, -5},
    {2, -4},
    {2, -3},
    {2, -1},
    {2, 0},
    {2, 1},
    {2, 3},
    {2, 4},
    {2, 5},
    {3, -6},
    {3, -4},
    {3, -3},
    {3, -2},
    {3, -1},
    {3, -1},
    {3, 0},
    {3, 1},
    {3, 2},
    {3, 3},
    {3, 4},
    {3, 6},
    {4, -5},
    {4, -3},
    {4, -2},
    {4, -1},
    {4, 0},
    {4, 1},
    {4, 2},
    {4, 3},
    {4, 5},
    {5, -4},
    {5, -2},
    {5, 0},
    {5, 2},
    {5, 4},
    {6, -3},
    {6, -1},
    {6, 1},
    {6, 3}};

    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String str;

        while (!"".equals(str = br.readLine())) {

            if (str == null) {
                break;
            }

            String strs[] = str.split(" ");

            int place[] = new int[]{Integer.parseInt(strs[0]), Integer.parseInt(strs[1])};

            for (int i = 0; i < dest.length; i++) {
                if (dest[i][0] == place[0] && dest[i][1] == place[1]) {
                    System.out.println("YES");
                    return;
                }
            }

            System.out.println("NO");

        }
    }
}
0