結果
| 問題 | 
                            No.713 素数の和
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-06-13 16:03:43 | 
| 言語 | F#  (F# 4.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 349 ms / 2,000 ms | 
| コード長 | 320 bytes | 
| コンパイル時間 | 9,009 ms | 
| コンパイル使用メモリ | 186,204 KB | 
| 実行使用メモリ | 35,752 KB | 
| 最終ジャッジ日時 | 2024-06-25 13:17:20 | 
| 合計ジャッジ時間 | 13,767 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 6 | 
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.fsproj を復元しました (258 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
let isPrime n =
    let limit = n |> float |> sqrt |> ceil |> int
    let rec check i =
        if i > limit then true elif n % i = 0 then false else check (i+1)
    if n > 2 then check 2 else 2 = n
let n = stdin.ReadLine().Trim() |> int
[| for i in 2 .. n -> i |]
|> Array.filter isPrime
|> Array.sum
|> printfn "%d"