結果

問題 No.144 エラトステネスのざる
ユーザー むらためむらため
提出日時 2019-01-20 12:59:13
言語 Nim
(2.0.2)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 3,347 ms
コンパイル使用メモリ 70,916 KB
実行使用メモリ 11,020 KB
最終ジャッジ日時 2023-09-14 02:22:57
合計ジャッジ時間 4,145 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 63 ms
10,928 KB
testcase_14 AC 59 ms
10,896 KB
testcase_15 AC 60 ms
10,996 KB
testcase_16 AC 59 ms
10,992 KB
testcase_17 AC 59 ms
11,020 KB
testcase_18 AC 63 ms
10,928 KB
testcase_19 AC 60 ms
10,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sequtils,strutils
let S = stdin.readLine().split()
let n = S[0].parseInt()
let p = S[1].parseFloat()
# 候補:[2,3,4,5,6,7,8,9,10]
# 素数:[]
# [3,4,5,6,7,8,9,10] ->
var A = newSeqWith(n+1,1.0)
var c = 0.0
for i in 2..n:
  # echo i,":",A
  c += A[i]
  for j in 2..n:
    let b = i * j
    if b > n: break
    A[b] *= 1.0 - p
echo c
0