結果

問題 No.144 エラトステネスのざる
ユーザー buey_tbuey_t
提出日時 2022-12-12 01:06:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 546 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 227,900 KB
最終ジャッジ日時 2024-04-23 19:15:32
合計ジャッジ時間 5,950 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 130 ms
92,928 KB
testcase_01 AC 128 ms
86,784 KB
testcase_02 AC 130 ms
86,836 KB
testcase_03 AC 127 ms
86,904 KB
testcase_04 AC 129 ms
86,908 KB
testcase_05 AC 129 ms
86,912 KB
testcase_06 AC 142 ms
89,764 KB
testcase_07 AC 140 ms
89,852 KB
testcase_08 AC 144 ms
89,696 KB
testcase_09 AC 139 ms
89,612 KB
testcase_10 AC 139 ms
89,600 KB
testcase_11 AC 142 ms
89,728 KB
testcase_12 AC 143 ms
89,564 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)

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 += (1-p)**memo[i]

print(ans)
0