結果

問題 No.144 エラトステネスのざる
ユーザー buey_tbuey_t
提出日時 2022-12-12 01:09:49
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 550 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 245,688 KB
最終ジャッジ日時 2024-04-23 19:18:44
合計ジャッジ時間 6,698 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
86,912 KB
testcase_01 AC 124 ms
86,912 KB
testcase_02 AC 120 ms
87,168 KB
testcase_03 AC 124 ms
86,912 KB
testcase_04 AC 120 ms
87,040 KB
testcase_05 AC 122 ms
86,528 KB
testcase_06 AC 133 ms
89,600 KB
testcase_07 AC 137 ms
89,600 KB
testcase_08 AC 137 ms
89,856 KB
testcase_09 AC 141 ms
89,856 KB
testcase_10 AC 132 ms
89,856 KB
testcase_11 AC 130 ms
89,600 KB
testcase_12 AC 132 ms
89,472 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
権限があれば一括ダウンロードができます

ソースコード

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)

ans = 0
memo = defaultdict(int)

for i in range(2, N+1):
    for j in range(i+i, N+1, i):  #三つ目でstep指定
        memo[j] += 1
    ans += pow((1-p),memo[i])

print(ans)
0