結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2015-07-16 16:10:47 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 51 ms / 2,000 ms |
コード長 | 2,325 bytes |
コンパイル時間 | 1,947 ms |
コンパイル使用メモリ | 77,136 KB |
実行使用メモリ | 50,476 KB |
最終ジャッジ日時 | 2024-10-07 20:57:45 |
合計ジャッジ時間 | 4,596 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
import java.io.BufferedReader;import java.io.InputStreamReader;public class Main {//取りうる座標を全て定数化しておくprivate static final int dest[][] = new int[][]{{-6, -3},{-6, -1},{-6, 1},{-6, 3},{-5, -4},{-5, -2},{-5, 0},{-5, 2},{-5, 4},{-4, -5},{-4, -3},{-4, -2},{-4, -1},{-4, 0},{-4, 1},{-4, 2},{-4, 3},{-4, 5},{-3, -6},{-3, -4},{-3, -3},{-3, -2},{-3, -1},{-3, 0},{-3, 1},{-3, 2},{-3, 3},{-3, 4},{-3, 6},{-2, -5},{-2, -4},{-2, -3},{-2, -1},{-2, 0},{-2, 1},{-2, 3},{-2, 4},{-2, 5},{-1, -6},{-1, -4},{-1, -3},{-1, -2},{-1, -1},{-1, 0},{-1, 1},{-1, 2},{-1, 3},{-1, 4},{-1, 6},{0, -5},{0, -4},{0, -3},{0, -2},{0, -1},{0, 0},{0, 1},{0, 2},{0, 3},{0, 4},{0, 5},{1, -6},{1, -4},{1, -3},{1, -2},{1, -1},{1, 0},{1, 1},{1, 2},{1, 3},{1, 4},{1, 6},{2, -5},{2, -4},{2, -3},{2, -1},{2, 0},{2, 1},{2, 3},{2, 4},{2, 5},{3, -6},{3, -4},{3, -3},{3, -2},{3, -1},{3, -1},{3, 0},{3, 1},{3, 2},{3, 3},{3, 4},{3, 6},{4, -5},{4, -3},{4, -2},{4, -1},{4, 0},{4, 1},{4, 2},{4, 3},{4, 5},{5, -4},{5, -2},{5, 0},{5, 2},{5, 4},{6, -3},{6, -1},{6, 1},{6, 3}};public static void main(String[] args) throws Exception {BufferedReader br = new BufferedReader(new InputStreamReader(System.in));String str;while (!"".equals(str = br.readLine())) {if (str == null) {break;}String strs[] = str.split(" ");int place[] = new int[]{Integer.parseInt(strs[0]), Integer.parseInt(strs[1])};for (int i = 0; i < dest.length; i++) {if (dest[i][0] == place[0] && dest[i][1] == place[1]) {System.out.println("YES");return;}}System.out.println("NO");}}}