結果

問題 No.36 素数が嫌い!
ユーザー pekempeypekempey
提出日時 2016-07-29 02:22:03
言語 Haskell
(9.8.2)
結果
AC  
実行時間 532 ms / 5,000 ms
コード長 404 bytes
コンパイル時間 1,872 ms
コンパイル使用メモリ 156,300 KB
実行使用メモリ 13,072 KB
最終ジャッジ日時 2023-09-09 07:39:59
合計ジャッジ時間 5,522 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
12,988 KB
testcase_01 AC 22 ms
12,868 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
7,008 KB
testcase_05 AC 5 ms
8,940 KB
testcase_06 AC 6 ms
9,944 KB
testcase_07 AC 7 ms
10,256 KB
testcase_08 AC 2 ms
6,900 KB
testcase_09 AC 3 ms
6,972 KB
testcase_10 AC 3 ms
7,184 KB
testcase_11 AC 183 ms
12,964 KB
testcase_12 AC 532 ms
12,944 KB
testcase_13 AC 532 ms
12,888 KB
testcase_14 AC 7 ms
10,312 KB
testcase_15 AC 2 ms
6,868 KB
testcase_16 AC 3 ms
6,996 KB
testcase_17 AC 2 ms
6,924 KB
testcase_18 AC 3 ms
6,948 KB
testcase_19 AC 32 ms
13,000 KB
testcase_20 AC 32 ms
12,976 KB
testcase_21 AC 82 ms
12,916 KB
testcase_22 AC 22 ms
12,964 KB
testcase_23 AC 12 ms
12,892 KB
testcase_24 AC 92 ms
12,984 KB
testcase_25 AC 102 ms
13,072 KB
testcase_26 AC 192 ms
12,980 KB
testcase_27 AC 22 ms
12,880 KB
testcase_28 AC 192 ms
13,032 KB
testcase_29 AC 13 ms
12,788 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

primeCount :: Integer -> Integer
primeCount n =
    fac n [2 .. ]
    where
        fac :: Integer -> [Integer] -> Integer
        fac n (x : xs)
            | x * x > n      = if n /= 1 then 1 else 0
            | n `rem` x == 0 = (fac (n `quot` x) (x : xs)) + 1
            | otherwise      = fac n xs

main = do
    n <- readLn :: IO Integer
    putStrLn $ if (primeCount n) >= 3 then "YES" else "NO"
0