結果

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

ソースコード

diff #

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


fun canUse n =
    let
        fun canUseAux i =
            if n mod i = 0 andalso i < n then true
            else if n <= i * i then false
            else canUseAux (i + 1)
    in
        if n = 1 then false
        else canUseAux 2
    end



val () =
    let
        val n = readLargeInt ()

        val ans = if canUse n then "YES"
                  else "NO"
    in
        print (ans ^ "\n")
    end
0