結果

問題 No.144 エラトステネスのざる
ユーザー buey_tbuey_t
提出日時 2022-12-12 00:40:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 668 bytes
コンパイル時間 201 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 96,284 KB
最終ジャッジ日時 2024-04-23 18:53:40
合計ジャッジ時間 5,727 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
94,148 KB
testcase_01 AC 114 ms
86,800 KB
testcase_02 AC 114 ms
87,180 KB
testcase_03 AC 112 ms
86,972 KB
testcase_04 AC 116 ms
86,748 KB
testcase_05 AC 114 ms
86,532 KB
testcase_06 AC 124 ms
89,428 KB
testcase_07 AC 122 ms
89,568 KB
testcase_08 AC 133 ms
89,824 KB
testcase_09 AC 132 ms
89,700 KB
testcase_10 AC 137 ms
90,008 KB
testcase_11 AC 138 ms
89,832 KB
testcase_12 AC 137 ms
89,540 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt,sin,cos,tan,ceil,radians,floor,gcd,exp,log,log10,log2,factorial
import heapq
import bisect
from collections import deque,Counter,defaultdict
from itertools import permutations,combinations
from decimal import Decimal,ROUND_HALF_UP
from functools import lru_cache
import sys
sys.setrecursionlimit(10**8)

N, p = map(float, input().split())
N = int(N)

#2は扱いにくいから先に足しておく
ans = 1

for i in range(3, N+1):
    count = 0
    for j in range(2, int(sqrt(i))+1):
        if i%j == 0:
            count += 1
            #重複に注意
            if i//j != j:
                count += 1
    ans += (1-p)**count

print(ans)
0