結果

問題 No.64 XORフィボナッチ数列
コンテスト
ユーザー Michae'Gon
提出日時 2015-04-22 17:21:36
言語 Haskell
(9.14.1)
コンパイル:
ghc -rtsopts -with-rtsopts=-K1G -o a.out -O2 _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 266 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 8,099 ms
コンパイル使用メモリ 195,456 KB
実行使用メモリ 12,672 KB
最終ジャッジ日時 2026-03-26 06:40:10
合計ジャッジ時間 34,221 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 TLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.14.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #
raw source code

import Data.Bits
import Data.Word
main = getLine >>= print . solve . map read . words

solve :: [Word64] -> Word64
solve [f0, f1, n]
        | n == 0 = f0
        | n == 1 = f1
        | otherwise = snd $ foldl (\(b2, b1) x -> (b1, xor b1 b2)) (f1, xor f0 f1) [3..n]
0