結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 85 ms
15,116 KB
testcase_01 AC 84 ms
15,212 KB
testcase_02 AC 81 ms
15,060 KB
testcase_03 AC 80 ms
15,272 KB
testcase_04 AC 80 ms
15,300 KB
testcase_05 AC 81 ms
15,220 KB
testcase_06 RE -
testcase_07 AC 81 ms
15,024 KB
testcase_08 RE -
testcase_09 AC 81 ms
15,052 KB
testcase_10 AC 81 ms
15,296 KB
testcase_11 AC 83 ms
15,244 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 80 ms
15,104 KB
testcase_15 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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
      :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