結果

問題 No.64 XORフィボナッチ数列
ユーザー neko_the_shadow
提出日時 2017-01-15 19:26:33
言語 Scheme
(Gauche-0.9.15)
結果
MLE  
実行時間 -
コード長 477 bytes
コンパイル時間 39 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 819,900 KB
最終ジャッジ日時 2024-12-21 13:46:30
合計ジャッジ時間 13,427 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 MLE * 4
権限があれば一括ダウンロードができます

ソースコード

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