結果
| 問題 | No.64 XORフィボナッチ数列 |
| コンテスト | |
| ユーザー |
karrym_
|
| 提出日時 | 2014-11-18 23:08:53 |
| 言語 | Haskell (9.10.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 359 bytes |
| 記録 | |
| コンパイル時間 | 13,500 ms |
| コンパイル使用メモリ | 179,840 KB |
| 実行使用メモリ | 21,156 KB |
| 最終ジャッジ日時 | 2025-01-02 17:41:22 |
| 合計ジャッジ時間 | 38,386 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 TLE * 4 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default
[1 of 2] Compiling Main ( Main.hs, Main.o )
Main.hs:8:36: warning: [GHC-63394] [-Wx-partial]
In the use of ‘tail’
(imported from Prelude, but defined in GHC.Internal.List):
"This is a partial function, it throws an error on empty lists. Replace it with 'drop' 1, or use pattern matching or 'GHC.Internal.Data.List.uncons' instead. Consider refactoring to use "Data.List.NonEmpty"."
|
8 | fib a b = a : b : zipWith' xor xs (tail xs) where
| ^^^^
[2 of 2] Linking a.out
ソースコード
import Data.Bits
zipWith' :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith' f (x:xs) (y:ys) = let z = f x y in z `seq` z : zipWith' f xs ys
zipWith' _ _ _ = []
fib :: Int -> Int -> [Int]
fib a b = a : b : zipWith' xor xs (tail xs) where
xs = fib a b
main = do
[a, b, n] <- fmap (map read . words) getLine
print $ fib a b !! n
karrym_