結果

問題 No.240 ナイト散歩
ユーザー villachvillach
提出日時 2017-10-12 09:45:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 731 bytes
コンパイル時間 3,382 ms
コンパイル使用メモリ 77,760 KB
実行使用メモリ 54,344 KB
最終ジャッジ日時 2024-04-28 17:01:21
合計ジャッジ時間 8,703 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
53,928 KB
testcase_01 AC 122 ms
54,096 KB
testcase_02 AC 121 ms
53,972 KB
testcase_03 AC 111 ms
52,952 KB
testcase_04 AC 123 ms
54,328 KB
testcase_05 AC 122 ms
53,864 KB
testcase_06 AC 122 ms
53,892 KB
testcase_07 AC 121 ms
53,844 KB
testcase_08 AC 124 ms
54,072 KB
testcase_09 AC 124 ms
53,908 KB
testcase_10 AC 123 ms
54,028 KB
testcase_11 AC 123 ms
53,896 KB
testcase_12 AC 124 ms
53,808 KB
testcase_13 AC 123 ms
54,212 KB
testcase_14 AC 121 ms
54,344 KB
testcase_15 AC 107 ms
52,952 KB
testcase_16 AC 114 ms
53,568 KB
testcase_17 AC 124 ms
54,300 KB
testcase_18 AC 128 ms
54,268 KB
testcase_19 AC 127 ms
53,940 KB
testcase_20 AC 114 ms
54,036 KB
testcase_21 AC 123 ms
54,080 KB
testcase_22 AC 125 ms
54,004 KB
testcase_23 AC 125 ms
53,888 KB
testcase_24 AC 123 ms
54,044 KB
testcase_25 AC 119 ms
53,956 KB
testcase_26 AC 121 ms
53,948 KB
testcase_27 AC 123 ms
54,020 KB
testcase_28 AC 120 ms
53,952 KB
testcase_29 AC 124 ms
54,132 KB
testcase_30 AC 118 ms
54,016 KB
testcase_31 AC 122 ms
53,872 KB
testcase_32 AC 126 ms
53,960 KB
testcase_33 AC 127 ms
53,800 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