結果

問題 No.144 エラトステネスのざる
ユーザー Kaito KoikeKaito Koike
提出日時 2018-04-17 14:54:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 280 bytes
コンパイル時間 235 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 16,012 KB
最終ジャッジ日時 2023-09-09 11:02:13
合計ジャッジ時間 17,471 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,824 KB
testcase_01 AC 15 ms
7,928 KB
testcase_02 AC 16 ms
7,864 KB
testcase_03 AC 15 ms
7,860 KB
testcase_04 AC 15 ms
7,844 KB
testcase_05 AC 15 ms
7,888 KB
testcase_06 AC 16 ms
7,860 KB
testcase_07 AC 16 ms
7,972 KB
testcase_08 AC 16 ms
7,812 KB
testcase_09 AC 16 ms
7,816 KB
testcase_10 AC 17 ms
7,796 KB
testcase_11 AC 17 ms
7,868 KB
testcase_12 AC 17 ms
7,876 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

input = input().split()
N = int(input[0])
p = float(input[1])

a = [0 for i in range(N+1)]

for i in range(2,N+1):
    for j in range(i*2,N+1,i):
        a[j] += 1
del a[:2]
e = 0
for number in a:
    if number == 0 :
        e += 1
    else:
        e += (1-p)**number

print(e)
0