結果

問題 No.36 素数が嫌い!
ユーザー tottoripaper
提出日時 2014-11-24 05:44:15
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 268 bytes
コンパイル時間 5,967 ms
コンパイル使用メモリ 178,560 KB
実行使用メモリ 10,240 KB
最終ジャッジ日時 2025-01-02 21:09:54
合計ジャッジ時間 8,472 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 WA * 9
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

isPrime 1 = False
isPrime n = helper n 2
  where
    helper n x
      | x * x > n = True
      | n `mod` x == 0 = False
      | otherwise = helper n (x+1)
                    
main = do
  n <- readLn
  putStrLn $ if n == 1 || isPrime n then "NO" else "YES"
0