結果

問題 No.240 ナイト散歩
ユーザー t8m8⛄️t8m8⛄️
提出日時 2015-08-14 21:27:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 962 bytes
コンパイル時間 3,726 ms
コンパイル使用メモリ 79,944 KB
実行使用メモリ 41,928 KB
最終ジャッジ日時 2024-04-16 19:34:50
合計ジャッジ時間 9,272 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
41,588 KB
testcase_01 AC 134 ms
41,632 KB
testcase_02 AC 135 ms
41,436 KB
testcase_03 AC 133 ms
41,464 KB
testcase_04 AC 132 ms
41,864 KB
testcase_05 AC 135 ms
41,428 KB
testcase_06 AC 121 ms
40,384 KB
testcase_07 AC 136 ms
41,928 KB
testcase_08 AC 135 ms
41,388 KB
testcase_09 AC 134 ms
41,608 KB
testcase_10 AC 135 ms
41,800 KB
testcase_11 AC 137 ms
41,408 KB
testcase_12 AC 134 ms
41,792 KB
testcase_13 AC 136 ms
41,572 KB
testcase_14 AC 134 ms
41,432 KB
testcase_15 AC 135 ms
41,560 KB
testcase_16 AC 135 ms
41,588 KB
testcase_17 AC 136 ms
41,416 KB
testcase_18 AC 134 ms
41,488 KB
testcase_19 AC 134 ms
41,904 KB
testcase_20 AC 135 ms
41,612 KB
testcase_21 AC 132 ms
41,560 KB
testcase_22 AC 133 ms
41,452 KB
testcase_23 AC 120 ms
41,320 KB
testcase_24 AC 136 ms
41,824 KB
testcase_25 AC 133 ms
41,712 KB
testcase_26 AC 133 ms
41,704 KB
testcase_27 AC 132 ms
41,196 KB
testcase_28 AC 132 ms
41,512 KB
testcase_29 AC 131 ms
41,412 KB
testcase_30 AC 134 ms
41,564 KB
testcase_31 AC 133 ms
41,168 KB
testcase_32 AC 133 ms
41,276 KB
testcase_33 AC 136 ms
41,416 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,1};

	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