結果

問題 No.240 ナイト散歩
ユーザー mastersatoshimastersatoshi
提出日時 2015-07-16 16:05:14
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,900 bytes
コンパイル時間 2,000 ms
コンパイル使用メモリ 73,588 KB
実行使用メモリ 51,492 KB
最終ジャッジ日時 2023-09-22 16:44:14
合計ジャッジ時間 4,549 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
49,076 KB
testcase_01 AC 42 ms
49,204 KB
testcase_02 AC 42 ms
49,288 KB
testcase_03 AC 41 ms
49,072 KB
testcase_04 AC 41 ms
49,300 KB
testcase_05 AC 41 ms
49,084 KB
testcase_06 AC 41 ms
49,080 KB
testcase_07 AC 41 ms
49,180 KB
testcase_08 AC 42 ms
49,300 KB
testcase_09 AC 42 ms
49,616 KB
testcase_10 AC 41 ms
49,312 KB
testcase_11 AC 41 ms
49,452 KB
testcase_12 AC 41 ms
49,120 KB
testcase_13 AC 41 ms
49,392 KB
testcase_14 AC 41 ms
49,272 KB
testcase_15 AC 41 ms
49,356 KB
testcase_16 AC 41 ms
49,192 KB
testcase_17 AC 41 ms
49,440 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 41 ms
49,116 KB
testcase_21 AC 42 ms
49,080 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 40 ms
49,108 KB
testcase_26 AC 41 ms
49,076 KB
testcase_27 AC 40 ms
49,416 KB
testcase_28 AC 41 ms
49,112 KB
testcase_29 AC 42 ms
49,316 KB
testcase_30 AC 41 ms
49,180 KB
testcase_31 AC 41 ms
49,596 KB
testcase_32 AC 41 ms
49,160 KB
testcase_33 AC 41 ms
49,184 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, -1},
    {-4, 1},
    {-4, 3},
    {-4, 5},
    {-3, -6},
    {-3, -4},
    {-3, -2},
    {-3, 0},
    {-3, 2},
    {-3, 4},
    {-3, 6},
    {-2, -5},
    {-2, -3},
    {-2, -1},
    {-2, 1},
    {-2, 3},
    {-2, 5},
    {-1, -6},
    {-1, -4},
    {-1, -2},
    {-1, 0},
    {-1, 2},
    {-1, 4},
    {-1, 6},
    {0, -5},
    {0, -3},
    {0, -1},
    {0, 0},
    {0, 1},
    {0, 3},
    {0, 5},
    {1, -6},
    {1, -4},
    {1, -2},
    {1, 0},
    {1, 2},
    {1, 4},
    {1, 6},
    {2, -5},
    {2, -3},
    {2, -1},
    {2, 1},
    {2, 3},
    {2, 5},
    {3, -6},
    {3, -4},
    {3, -2},
    {3, 0},
    {3, 2},
    {3, 4},
    {3, 6},
    {4, -5},
    {4, -3},
    {4, -1},
    {4, 1},
    {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