結果
問題 |
No.240 ナイト散歩
|
ユーザー |
![]() |
提出日時 | 2015-07-10 23:14:46 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 561 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 40,192 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-08 02:15:35 |
合計ジャッジ時間 | 1,292 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 WA * 8 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | int x,y;scanf("%d%d",&x,&y); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; int main(){ int x,y;scanf("%d%d",&x,&y); int b[101][101]={}; int dx[10]={-2,-2,2,2,-1,-1,1,1},dy[10]={-1,1,-1,1,-2,2,-2,2}; b[50][50]=1; if(abs(x)<10&&abs(y)<10&&b[y+50][x+50]){printf("YES\n");return 0;} for(int i=0;i<3;i++)for(int j=35;j<65;j++)for(int k=35;k<65;k++){ if(b[j][k]){ b[j][k]=0; for(int d=0;d<8;d++){ b[j+dy[d]][k+dx[d]]=1; if(j+dy[d]-50==y&&k+dx[d]-50==x){printf("YES\n");return 0;} } } } printf("NO\n"); return 0; }