結果

問題 No.144 エラトステネスのざる
ユーザー frnfntsfrnfnts
提出日時 2016-11-24 19:03:04
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 423 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 6,784 KB
実行使用メモリ 11,904 KB
最終ジャッジ日時 2024-05-05 13:02:19
合計ジャッジ時間 3,925 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 10 ms
11,904 KB
testcase_01 AC 10 ms
6,272 KB
testcase_02 AC 10 ms
6,144 KB
testcase_03 AC 10 ms
6,144 KB
testcase_04 AC 10 ms
6,400 KB
testcase_05 AC 9 ms
6,272 KB
testcase_06 AC 11 ms
6,400 KB
testcase_07 AC 12 ms
6,400 KB
testcase_08 AC 11 ms
6,272 KB
testcase_09 AC 11 ms
6,272 KB
testcase_10 AC 10 ms
6,528 KB
testcase_11 AC 11 ms
6,272 KB
testcase_12 AC 11 ms
6,400 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, p = map(float, raw_input().split())
# pro = [1.0 for i in range(int(n+1))]
n = int(n)
pro = [1.0] * (int(n))
l = range(2,int(n+1))
pri = []

while len(l) > 0:
    i = l.pop(0)
    pri.append(i)
    t = i*2
    # print t
    while t <= n:
        # print i, t
        # if t in l:
            # l.remove(t)
        pro[t-1] *= (1-p)
        t += i
# print pri
# print zip(pro, range(1,len(pro)+1))
print sum(pro) -1
    
0