結果
| 問題 |
No.240 ナイト散歩
|
| コンテスト | |
| ユーザー |
takatowin
|
| 提出日時 | 2017-01-09 15:34:19 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 799 bytes |
| コンパイル時間 | 777 ms |
| コンパイル使用メモリ | 23,424 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-18 00:18:48 |
| 合計ジャッジ時間 | 1,888 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 27 WA * 3 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:32:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%d %d",&X,&Y);
| ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<math.h>
int X,Y;
int make(int a,int b,int n){
if(n==3){
if(X==a && Y==b)
return 1;
else
return 0;
}else{
if(make(a-2,b-1,n+1)==1)
return 1;
else if(make(a-2,b+1,n+1)==1)
return 1;
else if(make(a-1,b-2,n+1)==1)
return 1;
else if(make(a-1,b+2,n+1)==1)
return 1;
else if(make(a+1,b-2,n+1)==1)
return 1;
else if(make(a+1,b+2,n+1)==1)
return 1;
else if(make(a+2,b-1,n+1)==1)
return 1;
else if(make(a+2,b+2,n+1)==1)
return 1;
}
return 0;
}
int main(void){
int num,i;
scanf("%d %d",&X,&Y);
if((int)fabs(X)>7 || (int)fabs(Y)>7)
puts("NO");
else if(X==0 && Y==0)
puts("YES");
else if(make(0,0,0)==1)
puts("YES");
else
puts("NO");
return 0;
}
takatowin