結果

問題 No.240 ナイト散歩
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-08-14 21:26:13
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 962 bytes
コンパイル時間 3,664 ms
コンパイル使用メモリ 75,244 KB
実行使用メモリ 56,216 KB
最終ジャッジ日時 2023-09-25 11:48:49
合計ジャッジ時間 9,580 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
55,608 KB
testcase_01 AC 123 ms
55,916 KB
testcase_02 AC 124 ms
55,372 KB
testcase_03 AC 125 ms
55,708 KB
testcase_04 AC 123 ms
56,064 KB
testcase_05 AC 122 ms
55,960 KB
testcase_06 AC 122 ms
55,768 KB
testcase_07 AC 122 ms
56,216 KB
testcase_08 AC 124 ms
55,812 KB
testcase_09 AC 126 ms
55,496 KB
testcase_10 AC 123 ms
55,888 KB
testcase_11 AC 122 ms
55,528 KB
testcase_12 AC 121 ms
55,752 KB
testcase_13 AC 125 ms
55,364 KB
testcase_14 AC 123 ms
55,788 KB
testcase_15 AC 121 ms
55,716 KB
testcase_16 AC 121 ms
55,548 KB
testcase_17 AC 122 ms
55,736 KB
testcase_18 AC 121 ms
55,792 KB
testcase_19 AC 121 ms
55,716 KB
testcase_20 AC 121 ms
55,704 KB
testcase_21 AC 121 ms
55,284 KB
testcase_22 AC 128 ms
56,044 KB
testcase_23 AC 120 ms
53,264 KB
testcase_24 AC 125 ms
55,900 KB
testcase_25 AC 122 ms
55,352 KB
testcase_26 AC 121 ms
55,624 KB
testcase_27 AC 121 ms
55,704 KB
testcase_28 AC 123 ms
56,104 KB
testcase_29 AC 124 ms
56,020 KB
testcase_30 AC 127 ms
55,380 KB
testcase_31 AC 127 ms
55,544 KB
testcase_32 WA -
testcase_33 AC 119 ms
55,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class No0240 {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);

	static void solve() {
		X = in.nextInt();
		Y = in.nextInt();
		out.println(rec(0,0,0) ? "YES" : "NO");
	}

	static int X,Y;

	static int[] dx = {-2,-2,-1,-1,1,1,2,2};
	static int[] dy = {-1,1,-2,2,-2,2,-1,2};

	static boolean rec(int x, int y, int depth) {
		if (x == X && y == Y) return true;
		if (depth == 3) return false;
		for (int i=0; i<8; i++) {
			if (rec(x+dx[i],y+dy[i],depth+1)) {
				return true;
			}
		}
		return false;
	}

	public static void main(String[] args) {
		long start = System.currentTimeMillis();

		solve();
		out.flush();

		long end = System.currentTimeMillis();
		//trace(end-start + "ms");
		in.close();
		out.close();
	}

	static void trace(Object... o) { System.out.println(Arrays.deepToString(o));}
}
0