結果

問題 No.240 ナイト散歩
ユーザー naimonon77naimonon77
提出日時 2015-11-11 14:25:09
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 969 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 57,000 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-13 14:25:06
合計ジャッジ時間 1,429 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 24 WA * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:41:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   41 |   scanf("%d %d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/* ここからが本編 */
/* */
/* 入力開始! */
/* 入力終了! */
int main(void)
{
  int i,j,k;
  int x,y;
  char e[13][13] = {0};
  for(i=0 ;i<8*8*8 ;i++) {
	int n = i;
	int x = 0,y = 0;
	for(j=0 ;j<3 ;j++) {
	  switch(n % 8) {
	  case 0: x -= 2; y -= 1; break;
	  case 1: x -= 2; y += 1; break;
	  case 2: x -= 1; y -= 2; break;
	  case 3: x -= 1; y += 2; break;
	  case 4: x += 1; y -= 2; break;
	  case 5: x += 1; y += 2; break;
	  case 6: x += 2; y -= 1; break;
	  case 7: x += 2; y += 1; break;
	  default: break;
	  }
	  n /= 8;
	}
	e[6+x][6+y] = 1;
  }
  scanf("%d %d",&x,&y);
  if(x < -6 || 6 < x || y < -6 || 6 < x) {
	puts("NO");
  }
  else if(e[6+x][6+y]) puts("YES");
  else puts("NO");
  return 0;
}
0