結果

問題 No.64 XORフィボナッチ数列
ユーザー neko_the_shadowneko_the_shadow
提出日時 2017-01-15 19:26:33
言語 Scheme
(Gauche-0.9.14)
結果
MLE  
実行時間 -
コード長 477 bytes
コンパイル時間 54 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 817,408 KB
最終ジャッジ日時 2023-08-23 11:16:49
合計ジャッジ時間 4,405 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
11,892 KB
testcase_01 AC 17 ms
13,872 KB
testcase_02 AC 17 ms
11,684 KB
testcase_03 AC 16 ms
11,868 KB
testcase_04 AC 17 ms
11,912 KB
testcase_05 AC 18 ms
11,912 KB
testcase_06 AC 19 ms
11,792 KB
testcase_07 AC 18 ms
11,680 KB
testcase_08 AC 16 ms
11,708 KB
testcase_09 MLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (solve f0 f1 n)
    (define *memo* (make-hash-table))
    (define (f k)
        (if (hash-table-exists? *memo* k)
            (hash-table-get *memo* k)
            (cond
                ((= k 0) f0)
                ((= k 1) f1)
                (else
                    (hash-table-put! *memo* k (logxor (f (- k 1)) (f (- k 2))))
                    (hash-table-get *memo* k)))))
    (f n))

(print (apply solve (map string->number (string-split (read-line) #\space))))
0