結果

問題 No.240 ナイト散歩
ユーザー hhgfhn1hhgfhn1
提出日時 2018-10-21 12:31:32
言語 Java19
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 611 bytes
コンパイル時間 3,887 ms
コンパイル使用メモリ 78,080 KB
実行使用メモリ 56,036 KB
最終ジャッジ日時 2023-08-12 05:40:31
合計ジャッジ時間 8,765 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,776 KB
testcase_01 AC 121 ms
56,016 KB
testcase_02 AC 121 ms
55,400 KB
testcase_03 AC 118 ms
55,904 KB
testcase_04 AC 120 ms
55,436 KB
testcase_05 AC 120 ms
55,440 KB
testcase_06 AC 123 ms
55,876 KB
testcase_07 AC 122 ms
55,760 KB
testcase_08 AC 120 ms
55,752 KB
testcase_09 AC 127 ms
55,740 KB
testcase_10 AC 126 ms
55,716 KB
testcase_11 AC 121 ms
55,588 KB
testcase_12 AC 118 ms
55,564 KB
testcase_13 AC 122 ms
55,420 KB
testcase_14 AC 124 ms
55,816 KB
testcase_15 AC 121 ms
55,744 KB
testcase_16 AC 123 ms
56,000 KB
testcase_17 AC 123 ms
55,804 KB
testcase_18 AC 127 ms
55,968 KB
testcase_19 AC 124 ms
55,868 KB
testcase_20 AC 120 ms
55,668 KB
testcase_21 AC 121 ms
55,684 KB
testcase_22 AC 126 ms
55,952 KB
testcase_23 AC 121 ms
55,440 KB
testcase_24 AC 124 ms
55,512 KB
testcase_25 AC 124 ms
55,676 KB
testcase_26 AC 120 ms
55,944 KB
testcase_27 AC 123 ms
55,904 KB
testcase_28 AC 123 ms
55,572 KB
testcase_29 AC 123 ms
55,704 KB
testcase_30 AC 120 ms
55,444 KB
testcase_31 AC 125 ms
55,840 KB
testcase_32 AC 123 ms
56,036 KB
testcase_33 AC 121 ms
55,776 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