結果

問題 No.240 ナイト散歩
ユーザー kohaku_kohakukohaku_kohaku
提出日時 2016-12-02 21:01:53
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 1,110 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 77,092 KB
実行使用メモリ 41,784 KB
最終ジャッジ日時 2024-04-16 19:44:56
合計ジャッジ時間 7,690 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,052 KB
testcase_01 AC 130 ms
41,500 KB
testcase_02 AC 131 ms
41,180 KB
testcase_03 AC 131 ms
41,320 KB
testcase_04 AC 131 ms
41,368 KB
testcase_05 AC 133 ms
41,272 KB
testcase_06 AC 132 ms
41,564 KB
testcase_07 AC 133 ms
41,692 KB
testcase_08 AC 118 ms
40,152 KB
testcase_09 AC 133 ms
41,272 KB
testcase_10 AC 134 ms
41,636 KB
testcase_11 AC 130 ms
41,484 KB
testcase_12 AC 132 ms
41,696 KB
testcase_13 AC 130 ms
41,296 KB
testcase_14 AC 131 ms
41,308 KB
testcase_15 AC 131 ms
41,304 KB
testcase_16 AC 134 ms
41,180 KB
testcase_17 AC 130 ms
41,188 KB
testcase_18 AC 132 ms
41,624 KB
testcase_19 AC 119 ms
41,380 KB
testcase_20 AC 131 ms
41,404 KB
testcase_21 AC 136 ms
41,412 KB
testcase_22 AC 130 ms
41,328 KB
testcase_23 AC 132 ms
41,400 KB
testcase_24 AC 131 ms
41,304 KB
testcase_25 AC 131 ms
41,504 KB
testcase_26 AC 132 ms
41,188 KB
testcase_27 AC 132 ms
41,784 KB
testcase_28 AC 132 ms
41,384 KB
testcase_29 AC 132 ms
41,672 KB
testcase_30 AC 129 ms
41,668 KB
testcase_31 AC 127 ms
41,380 KB
testcase_32 AC 130 ms
41,396 KB
testcase_33 AC 132 ms
41,568 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<4; k++){
            if(b[k][x+6][y+6]){
                System.out.println("YES");
                return;
            }
        }
        System.out.println("NO");
    }
}
0