結果

問題 No.240 ナイト散歩
ユーザー fjafjafjafjafjafja
提出日時 2017-09-19 20:05:00
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,170 bytes
コンパイル時間 3,480 ms
コンパイル使用メモリ 77,860 KB
実行使用メモリ 56,160 KB
最終ジャッジ日時 2024-04-25 18:17:19
合計ジャッジ時間 8,359 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
52,708 KB
testcase_01 AC 121 ms
53,912 KB
testcase_02 AC 123 ms
54,200 KB
testcase_03 AC 118 ms
53,980 KB
testcase_04 AC 117 ms
53,892 KB
testcase_05 WA -
testcase_06 AC 104 ms
54,000 KB
testcase_07 AC 123 ms
54,164 KB
testcase_08 AC 110 ms
53,096 KB
testcase_09 AC 115 ms
53,108 KB
testcase_10 AC 121 ms
54,440 KB
testcase_11 AC 120 ms
53,940 KB
testcase_12 AC 116 ms
53,904 KB
testcase_13 AC 126 ms
54,080 KB
testcase_14 AC 122 ms
54,196 KB
testcase_15 AC 113 ms
53,048 KB
testcase_16 AC 125 ms
54,272 KB
testcase_17 AC 114 ms
53,292 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 120 ms
54,300 KB
testcase_23 AC 123 ms
54,096 KB
testcase_24 AC 122 ms
54,264 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 119 ms
54,092 KB
testcase_29 AC 115 ms
54,124 KB
testcase_30 AC 124 ms
54,060 KB
testcase_31 AC 111 ms
53,004 KB
testcase_32 AC 106 ms
53,068 KB
testcase_33 AC 122 ms
54,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;

import java.util.Scanner;

public class N240
{
	static int x,y,nowx=0,nowy=0,end=0;
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		x=sc.nextInt();y=sc.nextInt();
		check();
		for(int i=0;end==0&&i<=7;i++)
		{	nowx=0;nowy=0;
			move(i);
			check();
			//System.out.print("["+nowx+","+nowy+"]"+" ");
			for(int j=0;end==0&&j<=7;j++)
			{
				move(j);
				check();
				//System.out.print("["+nowx+","+nowy+"]"+" ");
				for(int k=0;end==0&&k<=7;k++)
				{
					move(k);
					check();
					//System.out.println("["+i+","+j+","+k+"]");
					//System.out.println();
				}
			}
		}
		if(end==1){System.out.println("YES");}
		else{System.out.println("NO");}
	}

	static void check()
	{
		if(x==nowx&&y==nowy){end=1;return;}
		else {return ;}
	}


	static void move(int i)
	{
		switch(i)
		{
		case 0:
			nowx+=2;nowy+=1;
			break;
		case 1:
			nowx+=2;nowy-=1;
			break;
		case 2:
			nowx-=2;nowy+=1;
			break;
		case 3:
			nowx-=2;nowy-=1;
			break;
		case 4:
			nowx+=1;nowy+=2;
			break;
		case 5:
			nowx+=1;nowy-=2;
			break;
		case 6:
			nowx-=1;nowy+=2;
			break;
		case 7:
			nowx-=1;nowy-=2;
			break;
		}
	}

}
0