結果

問題 No.240 ナイト散歩
ユーザー villachvillach
提出日時 2017-10-12 09:45:29
言語 Java19
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 731 bytes
コンパイル時間 2,994 ms
コンパイル使用メモリ 74,152 KB
実行使用メモリ 56,576 KB
最終ジャッジ日時 2023-08-10 23:54:03
合計ジャッジ時間 9,312 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
56,072 KB
testcase_01 AC 116 ms
55,592 KB
testcase_02 AC 116 ms
55,652 KB
testcase_03 AC 116 ms
56,044 KB
testcase_04 AC 117 ms
55,368 KB
testcase_05 AC 118 ms
55,624 KB
testcase_06 AC 117 ms
55,588 KB
testcase_07 AC 116 ms
55,964 KB
testcase_08 AC 117 ms
56,096 KB
testcase_09 AC 113 ms
56,020 KB
testcase_10 AC 115 ms
55,984 KB
testcase_11 AC 122 ms
55,696 KB
testcase_12 AC 119 ms
56,576 KB
testcase_13 AC 116 ms
56,004 KB
testcase_14 AC 115 ms
55,856 KB
testcase_15 AC 125 ms
55,664 KB
testcase_16 AC 116 ms
55,740 KB
testcase_17 AC 113 ms
56,120 KB
testcase_18 AC 125 ms
55,840 KB
testcase_19 AC 123 ms
55,396 KB
testcase_20 AC 124 ms
55,680 KB
testcase_21 AC 122 ms
55,900 KB
testcase_22 AC 115 ms
55,872 KB
testcase_23 AC 116 ms
56,172 KB
testcase_24 AC 119 ms
55,732 KB
testcase_25 AC 116 ms
55,940 KB
testcase_26 AC 115 ms
56,156 KB
testcase_27 AC 112 ms
55,880 KB
testcase_28 AC 120 ms
55,792 KB
testcase_29 AC 115 ms
55,664 KB
testcase_30 AC 114 ms
55,656 KB
testcase_31 AC 116 ms
56,028 KB
testcase_32 AC 118 ms
55,808 KB
testcase_33 AC 119 ms
56,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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));
	}
}
0