結果

問題 No.240 ナイト散歩
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-21 12:31:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 73,956 KB
実行使用メモリ 41,312 KB
最終ジャッジ日時 2024-04-29 20:15:16
合計ジャッジ時間 7,451 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 127 ms
41,152 KB
testcase_01 AC 114 ms
40,000 KB
testcase_02 AC 126 ms
40,880 KB
testcase_03 AC 117 ms
39,840 KB
testcase_04 AC 114 ms
39,656 KB
testcase_05 AC 127 ms
40,912 KB
testcase_06 AC 125 ms
41,064 KB
testcase_07 AC 126 ms
40,896 KB
testcase_08 AC 131 ms
41,072 KB
testcase_09 AC 116 ms
39,784 KB
testcase_10 AC 116 ms
39,988 KB
testcase_11 AC 115 ms
39,928 KB
testcase_12 AC 128 ms
41,112 KB
testcase_13 AC 120 ms
40,432 KB
testcase_14 AC 128 ms
40,984 KB
testcase_15 AC 113 ms
39,728 KB
testcase_16 AC 114 ms
40,120 KB
testcase_17 AC 114 ms
39,940 KB
testcase_18 AC 128 ms
41,052 KB
testcase_19 AC 126 ms
41,036 KB
testcase_20 AC 128 ms
40,900 KB
testcase_21 AC 120 ms
39,860 KB
testcase_22 AC 126 ms
41,012 KB
testcase_23 AC 117 ms
39,632 KB
testcase_24 AC 129 ms
40,784 KB
testcase_25 AC 115 ms
39,984 KB
testcase_26 AC 128 ms
41,028 KB
testcase_27 AC 116 ms
39,984 KB
testcase_28 AC 133 ms
40,928 KB
testcase_29 AC 128 ms
41,312 KB
testcase_30 AC 115 ms
39,800 KB
testcase_31 AC 125 ms
41,096 KB
testcase_32 AC 128 ms
40,972 KB
testcase_33 AC 114 ms
39,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		int x=scanner.nextInt();
		int y=scanner.nextInt();
		int xs[]={-2,-2,-1,-1,1,1,2,2};
		int ys[]={-1,1,-2,2,-2,2,-1,1};
		dfs(0,0,0,x,y,xs,ys);
		System.out.println(bo?"YES":"NO");
	}

	static boolean bo=false;
	private static void dfs(int i, int x, int y,int gx,int gy, int[] xs, int[] ys) {
		if(x==gx&&y==gy){
			bo=true;
			return;
		}
		if(i==3){
			return;
		}
		
		for(int j=0;j<8;j++){
			dfs(i+1,x+xs[j],y+ys[j],gx,gy,xs,ys);
		}
	}
}
0