結果

問題 No.64 XORフィボナッチ数列
ユーザー ducktailducktail
提出日時 2018-01-18 13:24:22
言語 Haskell
(9.8.2)
結果
MLE  
実行時間 -
コード長 304 bytes
コンパイル時間 1,089 ms
コンパイル使用メモリ 167,884 KB
実行使用メモリ 817,800 KB
最終ジャッジ日時 2023-08-25 23:15:59
合計ジャッジ時間 8,075 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,056 KB
testcase_01 AC 3 ms
7,012 KB
testcase_02 AC 2 ms
7,040 KB
testcase_03 AC 3 ms
7,048 KB
testcase_04 AC 3 ms
7,056 KB
testcase_05 AC 2 ms
7,052 KB
testcase_06 AC 2 ms
7,072 KB
testcase_07 AC 2 ms
7,116 KB
testcase_08 AC 2 ms
7,120 KB
testcase_09 MLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative ((<$>))
import Data.Bits (xor)

main :: IO ()
main = do
  solve <$> getl (map read . words) >>= print

solve :: [Int] -> Int
solve [f0, f1, n] = f f0 f1 0
  where
    f x y z = if z == n then x else f y (x `xor` y) (z + 1)

getl :: (String -> a) -> IO a
getl f = f <$> getLine
0