結果

問題 No.144 エラトステネスのざる
ユーザー gr1msl3ygr1msl3y
提出日時 2022-05-17 23:31:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 175 bytes
コンパイル時間 1,033 ms
コンパイル使用メモリ 86,888 KB
実行使用メモリ 84,736 KB
最終ジャッジ日時 2023-10-14 02:41:25
合計ジャッジ時間 4,424 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,132 KB
testcase_01 AC 73 ms
71,188 KB
testcase_02 AC 75 ms
71,244 KB
testcase_03 AC 74 ms
71,304 KB
testcase_04 AC 71 ms
71,028 KB
testcase_05 AC 73 ms
71,132 KB
testcase_06 AC 82 ms
76,276 KB
testcase_07 AC 76 ms
76,324 KB
testcase_08 AC 75 ms
76,428 KB
testcase_09 AC 79 ms
76,384 KB
testcase_10 AC 75 ms
76,388 KB
testcase_11 AC 76 ms
76,308 KB
testcase_12 AC 75 ms
76,204 KB
testcase_13 AC 157 ms
84,656 KB
testcase_14 AC 158 ms
84,648 KB
testcase_15 AC 155 ms
84,736 KB
testcase_16 AC 164 ms
84,732 KB
testcase_17 AC 162 ms
84,592 KB
testcase_18 AC 171 ms
84,600 KB
testcase_19 AC 169 ms
84,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, p = input().split()
N = int(N)
p = float(p)
A = [1.0]*(N+1)
A[0] = A[1] = 0.0
for i in range(2, N+1):
    for j in range(2*i, N+1, i):
        A[j] *= 1.0-p

print(sum(A))
0