結果

問題 No.144 エラトステネスのざる
ユーザー frnfnts
提出日時 2016-11-24 19:03:04
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 423 bytes
コンパイル時間 375 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 74,604 KB
最終ジャッジ日時 2024-11-27 10:42:25
合計ジャッジ時間 22,340 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 TLE * 7
権限があれば一括ダウンロードができます

ソースコード

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