結果

問題 No.683 Two Operations No.3
ユーザー cympfhcympfh
提出日時 2018-05-19 21:08:37
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 246 ms
コンパイル使用メモリ 11,448 KB
実行使用メモリ 18,152 KB
最終ジャッジ日時 2023-09-10 23:48:51
合計ジャッジ時間 2,381 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 81 ms
15,276 KB
testcase_02 AC 81 ms
15,240 KB
testcase_03 AC 81 ms
15,144 KB
testcase_04 AC 81 ms
15,236 KB
testcase_05 AC 85 ms
15,140 KB
testcase_06 RE -
testcase_07 WA -
testcase_08 RE -
testcase_09 AC 81 ms
15,272 KB
testcase_10 AC 80 ms
15,204 KB
testcase_11 WA -
testcase_12 AC 80 ms
15,216 KB
testcase_13 AC 79 ms
15,260 KB
testcase_14 WA -
testcase_15 AC 80 ms
15,328 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def good(n,m)
  if n == 0 && m == 0
    :Yes
  elsif n < 0 or m < 0
    :No
  elsif n.odd? and m.odd?
    :No
  elsif n.even? and m.even?
    if good(n/2, m-1) == :Yes or good(n-1, m/2)
      :Yes
    else
      :No
    end
  elsif n.even?
    good(n/2, m-1)
  else
    good(n-1, m/2)
  end
end

n,m=gets.split.map(&:to_i)
puts good(n,m)
0