結果

問題 No.240 ナイト散歩
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-02 21:00:48
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,110 bytes
コンパイル時間 1,980 ms
コンパイル使用メモリ 73,700 KB
実行使用メモリ 57,996 KB
最終ジャッジ日時 2023-08-18 12:30:36
合計ジャッジ時間 7,706 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
55,616 KB
testcase_01 AC 120 ms
55,364 KB
testcase_02 WA -
testcase_03 AC 120 ms
55,832 KB
testcase_04 AC 115 ms
55,940 KB
testcase_05 WA -
testcase_06 AC 121 ms
55,380 KB
testcase_07 AC 119 ms
55,556 KB
testcase_08 AC 119 ms
55,760 KB
testcase_09 AC 123 ms
55,376 KB
testcase_10 AC 119 ms
55,832 KB
testcase_11 AC 121 ms
55,612 KB
testcase_12 AC 119 ms
55,472 KB
testcase_13 AC 124 ms
55,832 KB
testcase_14 AC 125 ms
55,664 KB
testcase_15 AC 121 ms
54,024 KB
testcase_16 AC 122 ms
55,740 KB
testcase_17 AC 121 ms
55,656 KB
testcase_18 AC 116 ms
56,368 KB
testcase_19 AC 119 ms
55,628 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 121 ms
55,372 KB
testcase_23 AC 120 ms
55,364 KB
testcase_24 AC 121 ms
55,632 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 121 ms
55,660 KB
testcase_29 AC 119 ms
55,632 KB
testcase_30 AC 124 ms
55,920 KB
testcase_31 AC 121 ms
56,080 KB
testcase_32 AC 123 ms
55,392 KB
testcase_33 AC 121 ms
53,836 KB
権限があれば一括ダウンロードができます

ソースコード

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();
        if(Math.max(x,y)>6 || Math.min(x,y)<-6){
            System.out.println("NO");
            return;
        }
        boolean [][][] b = new boolean[4][13][13];
        b[0][6][6]=true;
        for(int k=0; k<3; k++){
        for(int i=2; i<11; i++){
            for(int j=2; j<11; j++){
                if(b[k][i][j]){
                    b[k+1][i+2][j+1]=true;
                    b[k+1][i+2][j-1]=true;
                    b[k+1][i+1][j+2]=true;
                    b[k+1][i+1][j-2]=true;
                    b[k+1][i-1][j+2]=true;
                    b[k+1][i-1][j-2]=true;
                    b[k+1][i-2][j+1]=true;
                    b[k+1][i-2][j-1]=true;
                }
            }
        }
        }
        for(int k=0; k<3; k++){
            if(b[k][x+6][y+6]){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}
0