結果

問題 No.683 Two Operations No.3
ユーザー maimai
提出日時 2018-05-14 01:00:00
言語 Ruby
(3.3.0)
結果
AC  
実行時間 85 ms / 2,000 ms
コード長 456 bytes
コンパイル時間 190 ms
コンパイル使用メモリ 11,236 KB
実行使用メモリ 15,280 KB
最終ジャッジ日時 2023-09-10 19:42:46
合計ジャッジ時間 2,485 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
15,124 KB
testcase_01 AC 78 ms
15,136 KB
testcase_02 AC 77 ms
15,144 KB
testcase_03 AC 77 ms
15,152 KB
testcase_04 AC 85 ms
15,140 KB
testcase_05 AC 79 ms
15,168 KB
testcase_06 AC 77 ms
15,180 KB
testcase_07 AC 79 ms
15,220 KB
testcase_08 AC 78 ms
15,260 KB
testcase_09 AC 79 ms
15,268 KB
testcase_10 AC 78 ms
15,020 KB
testcase_11 AC 78 ms
15,268 KB
testcase_12 AC 79 ms
15,280 KB
testcase_13 AC 77 ms
15,072 KB
testcase_14 AC 78 ms
15,132 KB
testcase_15 AC 77 ms
15,220 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

# https://yukicoder.me/submissions/256892

def ascan; gets.split.map(&:to_i);end

A,B = ascan

# 計算時間解析用
#@h = []

def check(a,b)
    return true if a == 0 || b == 0
    return false if a < 0 || b < 0
    #@h << [a,b]
    ok = false
    ok ||= true if a > 0 && a.even? && check(a/2,b-1)
    ok ||= true if b > 0 && b.even? && check(a-1,b/2)
    return ok
end

puts check(A,B) ? "Yes" : "No"

#STDERR.puts @h.size
#STDERR.puts @h.map{|e|e*","}
0