結果

問題 No.312 置換処理
ユーザー aimyaimy
提出日時 2017-05-01 12:37:24
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 161,888 KB
実行使用メモリ 17,236 KB
最終ジャッジ日時 2023-10-12 02:02:31
合計ジャッジ時間 5,267 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,104 KB
testcase_01 AC 402 ms
15,080 KB
testcase_02 AC 652 ms
17,236 KB
testcase_03 AC 652 ms
17,228 KB
testcase_04 AC 2 ms
7,124 KB
testcase_05 AC 2 ms
7,108 KB
testcase_06 AC 22 ms
11,612 KB
testcase_07 AC 132 ms
13,252 KB
testcase_08 AC 2 ms
7,040 KB
testcase_09 AC 2 ms
7,108 KB
testcase_10 AC 3 ms
7,252 KB
testcase_11 AC 42 ms
11,580 KB
testcase_12 AC 3 ms
7,004 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 3 ms
7,160 KB
testcase_23 RE -
testcase_24 AC 2 ms
7,100 KB
testcase_25 AC 2 ms
6,996 KB
testcase_26 AC 2 ms
7,004 KB
testcase_27 RE -
testcase_28 AC 2 ms
7,184 KB
testcase_29 AC 2 ms
7,004 KB
testcase_30 AC 62 ms
11,796 KB
testcase_31 WA -
testcase_32 AC 42 ms
11,596 KB
testcase_33 AC 152 ms
13,232 KB
testcase_34 AC 152 ms
13,260 KB
testcase_35 AC 22 ms
11,244 KB
testcase_36 AC 2 ms
7,048 KB
testcase_37 AC 2 ms
7,020 KB
testcase_38 WA -
testcase_39 AC 2 ms
7,076 KB
testcase_40 AC 3 ms
7,116 KB
testcase_41 AC 2 ms
7,216 KB
testcase_42 AC 2 ms
7,136 KB
testcase_43 AC 2 ms
7,020 KB
testcase_44 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Data.List

primes = 2:3:[x | i<-[1..], j<-[-1,1], let x = 6*i+j, isPrime x]
 where isPrime n = null [i | i<-takeWhile (\x -> x^2 <= n) primes, mod n i == 0]

main = readLn >>= print . head . filter (/=2) . factorization

factorization :: Integer -> [Integer]
factorization n = unfoldr fact (n, primes)
 where
  q = (floor . sqrt . fromIntegral) n
  fact (n', pps@(p:ps))
   | n' == 1 = Nothing
   | p > q = Just (n',(1,pps))
   | otherwise = let (d,m) = divMod n' p in if m==0 then Just (p,(d,pps)) else fact (n',ps)
0