結果

問題 No.64 XORフィボナッチ数列
ユーザー TANIGUCHI KousukeTANIGUCHI Kousuke
提出日時 2015-05-18 13:53:17
言語 Ruby
(3.3.0)
結果
RE  
実行時間 -
コード長 262 bytes
コンパイル時間 205 ms
コンパイル使用メモリ 11,340 KB
実行使用メモリ 18,160 KB
最終ジャッジ日時 2023-09-20 09:49:36
合計ジャッジ時間 2,088 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
15,296 KB
testcase_01 AC 81 ms
15,280 KB
testcase_02 AC 81 ms
15,296 KB
testcase_03 AC 81 ms
15,056 KB
testcase_04 AC 82 ms
15,264 KB
testcase_05 AC 83 ms
15,180 KB
testcase_06 AC 82 ms
15,048 KB
testcase_07 AC 83 ms
15,128 KB
testcase_08 AC 83 ms
15,272 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 AC 82 ms
15,164 KB
testcase_13 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

F0, F1, n = gets.split.map(&:to_i)
MEMO = {}
def fib_xor(n)
    case n
        when 1
        F1
        when 0
        F0
    else
        unless MEMO[n]
            MEMO[n] ||= fib_xor(n-1) ^ fib_xor(n-2)
        end
        MEMO[n]
    end
end
puts fib_xor(n)
0