結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
kou_kkk
|
| 提出日時 | 2025-07-14 12:36:36 |
| 言語 | Haskell (9.10.1) |
| 結果 |
AC
|
| 実行時間 | 144 ms / 5,000 ms |
| コード長 | 397 bytes |
| コンパイル時間 | 11,929 ms |
| コンパイル使用メモリ | 177,152 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-07-14 12:36:52 |
| 合計ジャッジ時間 | 14,014 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.10.1/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
module Main where
main :: IO ()
main = readLn >>= putStrLn . solve
solve :: Int -> String
solve n | isnotPrime n = "YES"
| otherwise = "NO"
isnotPrime :: Int -> Bool
isnotPrime = (>=3) . length . primes
primes :: Int -> [Int]
primes n = go n 2
go :: Int -> Int -> [Int]
go x i | i * i > x = [x]
| x `mod` i == 0 = i : go (x `div` i) i
| otherwise = go x $ succ i
kou_kkk