結果
| 問題 |
No.64 XORフィボナッチ数列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-22 17:21:36 |
| 言語 | Haskell (9.10.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 266 bytes |
| コンパイル時間 | 6,734 ms |
| コンパイル使用メモリ | 175,104 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-07-05 00:15:03 |
| 合計ジャッジ時間 | 13,390 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 TLE * 1 -- * 4 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
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]