結果
問題 | No.240 ナイト散歩 |
ユーザー | FF256grhy |
提出日時 | 2015-07-10 23:39:31 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 557 bytes |
コンパイル時間 | 306 ms |
コンパイル使用メモリ | 23,296 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-07 20:53:16 |
合計ジャッジ時間 | 1,061 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d%d", &x, &y); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>int memo[13][13];int main(void) {int x, y;scanf("%d%d", &x, &y);int dx[8] = {-2, -1, +1, +2, -2, -1, +1, +2};int dy[8] = {+1, +2, +2, +1, -1, -2, -2, -1};int n;memo[6][6] = 1;for(n = 0; n < 3; n++) {int i, j;for(j = 0; j < 13; j++) {for(i = 0; i < 13; i++) {if(memo[i][j] == n + 1) {int k;for(k = 0; k < 8; k++) {memo[ i + dx[k] ][ j + dy[k] ] = n + 2;}}}}}printf("%s\n", (-6 <= x && x <= 6 && -6 <= y && y <= 6 && memo[x + 6][y + 6]) ? "YES" : "NO");return 0;}