結果

問題 No.144 エラトステネスのざる
ユーザー しらっ亭しらっ亭
提出日時 2015-09-10 00:50:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 289 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 10,508 KB
実行使用メモリ 14,892 KB
最終ジャッジ日時 2023-09-26 10:22:20
合計ジャッジ時間 4,592 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
12,272 KB
testcase_01 AC 16 ms
7,824 KB
testcase_02 AC 17 ms
7,756 KB
testcase_03 AC 16 ms
7,888 KB
testcase_04 AC 16 ms
7,896 KB
testcase_05 AC 16 ms
7,784 KB
testcase_06 AC 17 ms
7,784 KB
testcase_07 AC 17 ms
7,856 KB
testcase_08 AC 16 ms
7,728 KB
testcase_09 AC 16 ms
7,748 KB
testcase_10 AC 16 ms
7,740 KB
testcase_11 AC 19 ms
7,752 KB
testcase_12 AC 17 ms
7,864 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve():
    inp = input().split()
    N = int(inp[0])
    p = 1 - float(inp[1])

    s = [1.0] * (N + 1)
    for x in range(2, N + 1):
        for i in range(x + x, N + 1, x):
            s[i] *= p

    s[0] = 0
    s[1] = 0

    print(sum(s))

if __name__ == '__main__':
    solve()
0