結果
| 問題 |
No.240 ナイト散歩
|
| ユーザー |
kohaku_kohaku
|
| 提出日時 | 2016-12-02 21:01:53 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 126 ms / 2,000 ms |
| コード長 | 1,110 bytes |
| コンパイル時間 | 2,052 ms |
| コンパイル使用メモリ | 77,208 KB |
| 実行使用メモリ | 56,092 KB |
| 最終ジャッジ日時 | 2024-10-07 21:32:54 |
| 合計ジャッジ時間 | 7,248 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
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");
}
}
kohaku_kohaku