結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー kuuso1kuuso1
提出日時 2016-08-23 23:15:15
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 897 bytes
コンパイル時間 8,001 ms
コンパイル使用メモリ 200,136 KB
実行使用メモリ 39,548 KB
最終ジャッジ日時 2024-04-25 12:12:20
合計ジャッジ時間 21,482 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 302 ms
34,736 KB
testcase_01 AC 310 ms
34,500 KB
testcase_02 AC 296 ms
34,756 KB
testcase_03 WA -
testcase_04 AC 309 ms
34,760 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 297 ms
34,500 KB
testcase_09 WA -
testcase_10 AC 307 ms
34,628 KB
testcase_11 AC 336 ms
34,624 KB
testcase_12 AC 337 ms
34,820 KB
testcase_13 AC 338 ms
33,792 KB
testcase_14 WA -
testcase_15 AC 296 ms
34,500 KB
testcase_16 WA -
testcase_17 AC 310 ms
34,492 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 304 ms
34,896 KB
testcase_22 AC 320 ms
34,560 KB
testcase_23 WA -
testcase_24 AC 304 ms
35,628 KB
testcase_25 WA -
testcase_26 AC 313 ms
36,592 KB
testcase_27 AC 300 ms
34,376 KB
testcase_28 AC 310 ms
35,976 KB
testcase_29 WA -
testcase_30 AC 300 ms
35,348 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (211 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
        let mutable primes:int list = []
        isPrime.[0] <- false
        isPrime.[1] <- false
        let ul1 = L/2 |> double |> sqrt |> int |> (+) 1
        for i = 2 to ul1 do
            if isPrime.[i] = true then
                //for j in [(i*i)..i..(L/2 + 99)] do isPrime.[j] <- false 
                for j = 1 to (L/2 + 99)/(i*i) do isPrime.[j*i*i] <- false 
        
        let mutable ans:int64 = 0L
        for i = 2 to (L/2 + 1) do
            if isPrime.[i] = true && LL >= ((NL-1L) * (int64 i)) then
                ans <- ans + (int64 (( L - ((N-1) * i) + 1 )))
        
        printfn "%d" ans
        
let mySol = new Sol()
mySol.Solve()
0