結果
問題 | No.300 平方数 |
ユーザー | くれちー |
提出日時 | 2017-01-13 00:34:07 |
言語 | Haskell (9.8.2) |
結果 |
TLE
|
実行時間 | - |
コード長 | 468 bytes |
コンパイル時間 | 10,061 ms |
コンパイル使用メモリ | 171,264 KB |
実行使用メモリ | 14,884 KB |
最終ジャッジ日時 | 2024-12-21 10:17:24 |
合計ジャッジ時間 | 49,829 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
13,640 KB |
testcase_01 | AC | 2 ms
13,640 KB |
testcase_02 | AC | 3 ms
13,636 KB |
testcase_03 | AC | 2 ms
13,640 KB |
testcase_04 | AC | 1 ms
13,632 KB |
testcase_05 | AC | 2 ms
14,496 KB |
testcase_06 | AC | 2 ms
13,636 KB |
testcase_07 | AC | 2 ms
13,640 KB |
testcase_08 | AC | 2 ms
14,624 KB |
testcase_09 | AC | 2 ms
13,636 KB |
testcase_10 | AC | 1 ms
13,636 KB |
testcase_11 | AC | 2 ms
13,632 KB |
testcase_12 | AC | 2 ms
13,644 KB |
testcase_13 | AC | 84 ms
14,884 KB |
testcase_14 | AC | 1 ms
13,636 KB |
testcase_15 | AC | 2 ms
14,496 KB |
testcase_16 | AC | 1 ms
13,644 KB |
testcase_17 | AC | 1 ms
13,644 KB |
testcase_18 | AC | 2 ms
13,636 KB |
testcase_19 | AC | 2 ms
13,640 KB |
testcase_20 | TLE | - |
testcase_21 | AC | 2 ms
13,636 KB |
testcase_22 | AC | 2 ms
6,816 KB |
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 | - |
testcase_36 | TLE | - |
testcase_37 | TLE | - |
testcase_38 | AC | 4 ms
13,640 KB |
testcase_39 | TLE | - |
testcase_40 | TLE | - |
testcase_41 | TLE | - |
testcase_42 | AC | 4 ms
6,816 KB |
testcase_43 | TLE | - |
testcase_44 | TLE | - |
testcase_45 | 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:10:1: warning: [GHC-94817] [-Wtabs] Tab character found here, and in four further locations. Suggested fix: Please use spaces instead. | 10 | where | ^^^^^^^^ Main.hs:14:25: warning: [GHC-63394] [-Wx-partial] In the use of ‘head’ (imported from Data.List, 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." | 14 | solve x = product $ map head $ filter (odd . length) $ group $ factorization x | ^^^^ [2 of 2] Linking a.out
ソースコード
import Data.List -- ref: http://d.hatena.ne.jp/mokehehe/20070615/factorization factors :: Integral a => a -> [a] factors n = [x | x <- [1..n], n `mod` x == 0] factorization :: Integral a => a -> [a] factorization 1 = [] factorization x = v : factorization (x `div` v) where v = (factors x) !! 1 solve :: Integral a => a -> a solve x = product $ map head $ filter (odd . length) $ group $ factorization x main = do n <- readLn putStrLn $ show $ solve n