結果
| 問題 |
No.240 ナイト散歩
|
| コンテスト | |
| ユーザー |
kohaku_kohaku
|
| 提出日時 | 2016-12-02 21:00:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,110 bytes |
| コンパイル時間 | 3,547 ms |
| コンパイル使用メモリ | 77,032 KB |
| 実行使用メモリ | 41,392 KB |
| 最終ジャッジ日時 | 2024-11-27 17:33:30 |
| 合計ジャッジ時間 | 6,964 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 1 |
| other | AC * 24 WA * 6 |
ソースコード
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");
}
}
kohaku_kohaku