結果

問題 No.713 素数の和
ユーザー iwotiwot
提出日時 2020-06-13 15:54:10
言語 F#
(F# 4.0)
結果
AC  
実行時間 350 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 7,040 ms
コンパイル使用メモリ 186,452 KB
実行使用メモリ 35,168 KB
最終ジャッジ日時 2024-06-25 13:01:18
合計ジャッジ時間 11,227 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (236 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/

ソースコード

diff #

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

seq { for n in 2 .. n do n }
|> Seq.filter isPrime
|> Seq.sum
|> printfn "%d"
0