結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー kuuso1kuuso1
提出日時 2016-08-23 22:58:28
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 804 bytes
コンパイル時間 10,338 ms
コンパイル使用メモリ 201,108 KB
実行使用メモリ 226,252 KB
最終ジャッジ日時 2024-04-25 12:08:12
合計ジャッジ時間 14,539 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (242 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
/home/judge/data/code/Main.fs(4,13): warning FS0025: この式のパターン マッチが不完全です たとえば、値 '[|_; _; _|]' はパターンに含まれないケースを示す可能性があります。 [/home/judge/data/code/main.fsproj]
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

open System
type Sol() =
    member this.Solve() = 
        let [|N;L|] = stdin.ReadLine().Split() |> Array.map int
        
        let NL = int64 N
        let LL = int64 L
        
        let isPrime = Array.create (L/2 + 100) true
        isPrime.[0] <- false
        isPrime.[1] <- false
        for i = 2 to 1 + int ((sqrt (double (L/2 + 100)))) do
            if isPrime.[i] = true && LL >= ((NL-1L) * (int64 i)) then
                for j in [(i*i)..i..(L/2 + 99)] do isPrime.[j] <- false 
        
        let primes = Seq.zip isPrime [0..(L/2 + 99)] |> Seq.filter (fun (b,p) -> b = true) |>Seq.map snd
        
        let ans:int64 = primes |> Seq.sumBy (fun p -> (( L - ((N-1) * p) + 1 ) |> int64 ) )
        
        printfn "%d" ans
        
        ()
let mySol = new Sol()
mySol.Solve()
0