結果

問題 No.36 素数が嫌い!
ユーザー tanson
提出日時 2025-09-03 01:32:23
言語 Standard ML
(MLton 20210117)
結果
AC  
実行時間 251 ms / 5,000 ms
コード長 712 bytes
コンパイル時間 3,486 ms
コンパイル使用メモリ 691,580 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-03 01:32:33
合計ジャッジ時間 5,982 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

fun readLargeInt () =
    valOf (TextIO.scanStream (LargeInt.scan StringCvt.DEC) TextIO.stdIn)


fun factorization n =
    let
        fun factorizationAux m i =
            if m < i * i
            then
                (
                  if m <> 1 then [m] else []
                )
            else
                (
                  if m mod i = 0
                  then i :: factorizationAux (m div i) i 
                  else factorizationAux m (i + 1)
                )
    in
        factorizationAux n 2
    end

val () =
    let
        val n = readLargeInt ()

        val ans = if 3 <= List.length (factorization n) then "YES"
                  else "NO"
    in
        print (ans ^ "\n")
    end

0