結果
問題 | No.240 ナイト散歩 |
ユーザー |
|
提出日時 | 2015-11-11 14:26:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 968 bytes |
コンパイル時間 | 427 ms |
コンパイル使用メモリ | 58,056 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-06 08:43:45 |
合計ジャッジ時間 | 1,434 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 28 WA * 2 |
コンパイルメッセージ
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); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#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<9*9*9 ;i++) {int n = i;int x = 0,y = 0;for(j=0 ;j<3 ;j++) {switch(n % 9) {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 /= 9;}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;}