結果

問題 No.144 エラトステネスのざる
ユーザー むらためむらため
提出日時 2019-01-20 12:59:07
言語 Nim
(2.0.2)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 3,300 ms
コンパイル使用メモリ 71,608 KB
実行使用メモリ 36,732 KB
最終ジャッジ日時 2023-09-14 02:23:08
合計ジャッジ時間 9,939 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 OLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

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