結果

問題 No.144 エラトステネスのざる
ユーザー iwotiwot
提出日時 2020-06-23 15:19:04
言語 F#
(F# 4.0)
結果
AC  
実行時間 622 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 4,167 ms
コンパイル使用メモリ 158,528 KB
実行使用メモリ 67,464 KB
最終ジャッジ日時 2023-09-16 19:55:50
合計ジャッジ時間 10,753 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
25,236 KB
testcase_01 AC 95 ms
25,252 KB
testcase_02 AC 96 ms
27,244 KB
testcase_03 AC 94 ms
25,212 KB
testcase_04 AC 93 ms
25,052 KB
testcase_05 AC 93 ms
25,084 KB
testcase_06 AC 94 ms
25,392 KB
testcase_07 AC 93 ms
27,568 KB
testcase_08 AC 94 ms
25,576 KB
testcase_09 AC 91 ms
25,612 KB
testcase_10 AC 92 ms
25,532 KB
testcase_11 AC 95 ms
25,560 KB
testcase_12 AC 92 ms
25,380 KB
testcase_13 AC 540 ms
67,272 KB
testcase_14 AC 566 ms
67,448 KB
testcase_15 AC 565 ms
65,284 KB
testcase_16 AC 622 ms
67,448 KB
testcase_17 AC 597 ms
67,436 KB
testcase_18 AC 597 ms
67,464 KB
testcase_19 AC 547 ms
63,188 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let input = stdin.ReadLine().Split(' ')
let N = input.[0] |> int
let p = input.[1] |> float

let count = Array.zeroCreate (N+1)
for i = 2 to N do
    for j in i*2 .. i .. N do
        count.[j] <- count.[j] + 1

let p2 = 1.0 - p
[ for i = 2 to N do
    yield if count.[i] = 0 then 1.0 else p2 ** (float count.[i]) ]
|> List.sum
|> printfn "%f"
0