結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-03 01:05:59 |
| 言語 | Standard ML (MLton 20210117) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 785 bytes |
| コンパイル時間 | 3,856 ms |
| コンパイル使用メモリ | 688,764 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-03 01:06:06 |
| 合計ジャッジ時間 | 6,769 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 23 WA * 3 |
ソースコード
fun readLargeInt () =
valOf (TextIO.scanStream (LargeInt.scan StringCvt.DEC) TextIO.stdIn)
fun isPrimeNumber n =
let
fun isPrimeNumberAux i =
if n < i * i then true
else if n mod i = 0 then false
else isPrimeNumberAux (i + 1)
in
if n = 1 then false
else isPrimeNumberAux 2
end
fun canUse n =
let
fun canUseAux i =
if n mod i = 0 andalso isPrimeNumber i = false 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