結果
問題 | No.240 ナイト散歩 |
ユーザー |
|
提出日時 | 2017-10-12 09:45:29 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 142 ms / 2,000 ms |
コード長 | 731 bytes |
コンパイル時間 | 3,603 ms |
コンパイル使用メモリ | 77,020 KB |
実行使用メモリ | 54,196 KB |
最終ジャッジ日時 | 2024-11-17 10:46:54 |
合計ジャッジ時間 | 9,615 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
package yukicoder;import java.util.Scanner;public class N240 {public int x, y;public static void main(String[] args){Scanner sc = new Scanner(System.in);int x = sc.nextInt();int y = sc.nextInt();N240 hoge = new N240(x, y);}N240(int x, int y){this.x = x;this.y = y;if(this.hoge(0, 0, 0)){System.out.println("YES");}else{System.out.println("NO");}}public boolean hoge(int x, int y, int c){if(x == this.x && y == this.y){return true;}if(c >= 3){return false;}return(hoge(x-2, y-1, c+1) || hoge(x-2, y+1, c+1) || hoge(x-1, y-2, c+1) || hoge(x-1, y+2, c+1) || hoge(x+1, y-2, c+1) || hoge(x+1, y+2, c+1)|| hoge(x+2, y-1, c+1) || hoge(x+2, y+1, c+1));}}