結果

問題 No.240 ナイト散歩
ユーザー zazaboon
提出日時 2017-05-23 17:17:13
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 298 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 12,416 KB
最終ジャッジ日時 2024-09-19 11:42:04
合計ジャッジ時間 3,976 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 23 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def ser(x,y,d)
  return if(d==3)
  if(x == @x or y == @y)
    puts "YES"
    exit
  end
  ser(x-2,y-1,d+1)
  ser(x-2,y+1,d+1)
  ser(x-1,y-2,d+1)
  ser(x-1,y+2,d+1)
  ser(x+1,y-2,d+1)
  ser(x+1,y+2,d+1)
  ser(x+2,y-1,d+1)
  ser(x+2,y+1,d+1)
end
@x,@y=gets.chomp.split.map &:to_i
ser(0,0,0)
puts "NO"
0