結果

問題 No.144 エラトステネスのざる
ユーザー FromBooskaFromBooska
提出日時 2023-02-15 13:24:06
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 466 bytes
コンパイル時間 1,830 ms
コンパイル使用メモリ 86,468 KB
実行使用メモリ 96,508 KB
最終ジャッジ日時 2023-09-24 22:43:23
合計ジャッジ時間 5,458 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
75,780 KB
testcase_01 AC 74 ms
71,212 KB
testcase_02 AC 76 ms
71,624 KB
testcase_03 AC 75 ms
70,996 KB
testcase_04 AC 72 ms
71,316 KB
testcase_05 AC 72 ms
71,164 KB
testcase_06 AC 80 ms
75,464 KB
testcase_07 AC 80 ms
75,716 KB
testcase_08 AC 78 ms
75,864 KB
testcase_09 AC 80 ms
75,776 KB
testcase_10 AC 80 ms
75,828 KB
testcase_11 AC 79 ms
75,828 KB
testcase_12 AC 79 ms
75,760 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def divisor_count(n):
    cnt = 0
    i = 1
    while i*i < n:
        if n % i == 0:
            cnt += 2
        i += 1
    if i*i == n:
        cnt += 1
    return cnt

is_prime = [1] * (N+1)
is_prime[0], is_prime[1] = 0, 0

for i in range(2, N+1):
    is_prime[i] = pow(1-exe_prob, divisor_count(i)-2)
    #is_prime[i] = ((1-exe_prob)**(divisor_count(i)-2))
            
#print(is_prime)
print(sum(is_prime))
0