結果
問題 | No.420 mod2漸化式 |
ユーザー | くれちー |
提出日時 | 2016-12-27 13:06:05 |
言語 | Haskell (9.8.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 524 bytes |
コンパイル時間 | 14,961 ms |
コンパイル使用メモリ | 170,496 KB |
実行使用メモリ | 400,384 KB |
最終ジャッジ日時 | 2024-12-15 02:03:44 |
合計ジャッジ時間 | 90,606 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | TLE | - |
testcase_02 | TLE | - |
testcase_03 | TLE | - |
testcase_04 | TLE | - |
testcase_05 | TLE | - |
testcase_06 | TLE | - |
testcase_07 | TLE | - |
testcase_08 | TLE | - |
testcase_09 | TLE | - |
testcase_10 | TLE | - |
testcase_11 | TLE | - |
testcase_12 | TLE | - |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | TLE | - |
testcase_23 | TLE | - |
testcase_24 | TLE | - |
testcase_25 | TLE | - |
testcase_26 | TLE | - |
testcase_27 | TLE | - |
testcase_28 | TLE | - |
testcase_29 | TLE | - |
testcase_30 | TLE | - |
testcase_31 | TLE | - |
testcase_32 | TLE | - |
testcase_33 | TLE | - |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) Main.hs:21:22: warning: [GHC-63394] [-Wx-partial] In the use of ‘head’ (imported from Prelude, but defined in GHC.List): "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty." | 21 | putStrLn $ show (head ans) ++ " " ++ show (last ans) | ^^^^ [2 of 2] Linking a.out
ソースコード
getHalf :: [Int] -> [Int] getHalf l = drop (length l `div` 2) l makeList :: Int -> [Int] makeList 0 = [1] makeList x = makeList2 (makeList (pred x)) makeList2 :: [Int] -> [Int] makeList2 l | length l == 1 = l ++ [succ (last l)] | otherwise = l ++ makeList2 (getHalf l) solve :: Int -> [Int] solve x = [length l, sum l] where l = filter (== x) (foldr (++) [] (map makeList [0..30])) main :: IO () main = do x <- readLn let ans = solve x putStrLn $ show (head ans) ++ " " ++ show (last ans)