結果

問題 No.36 素数が嫌い!
コンテスト
ユーザー tanson
提出日時 2025-09-03 01:32:23
言語 Standard ML
(MLton 20241230)
コンパイル:
mlton_wrapper _filename_
実行:
./main
結果
AC  
実行時間 71 ms / 5,000 ms
+ 941µs
コード長 712 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,535 ms
コンパイル使用メモリ 704,836 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-07-14 13:41:10
合計ジャッジ時間 5,275 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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