結果

問題 No.36 素数が嫌い!
ユーザー はむ吉🐹
提出日時 2016-04-03 16:49:02
言語 Lua
(LuaJit 2.1.1734355927)
結果
AC  
実行時間 47 ms / 5,000 ms
コード長 418 bytes
コンパイル時間 76 ms
コンパイル使用メモリ 5,248 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 00:43:07
合計ジャッジ時間 1,134 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

function factorize (n)
    local factors = {}
    for i = 2, n do
        if i * i > n then
            break
        end
        while n % i == 0 do
            n = n / i
            table.insert(factors, i)
        end
    end
    if n > 1 then
        table.insert(factors, n)
    end
    return factors
end


n = io.read("*n")
factors = factorize(n)
if #factors >= 3 then
    print("YES")
else
    print("NO")
end
0