結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2015-07-10 23:30:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 635 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 40,064 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 20:52:25 |
合計ジャッジ時間 | 1,195 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
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; for(int i=0;i<3;i++){ int bb[101][101]={}; for(int j=35;j<65;j++)for(int k=35;k<65;k++){ if(b[j][k])for(int d=0;d<8;d++)bb[j+dy[d]][k+dx[d]]=1; if(abs(x)<10&&abs(y)<10&&bb[y+50][x+50]){printf("YES\n");return 0;} } memcpy(b,bb,sizeof(int)*101*101); } /* for(int j=35;j<65;j++){for(int k=35;k<65;k++){ printf("%d",b[j][k]);} printf("\n"); }*/ printf("NO\n"); return 0; }