結果

問題 No.144 エラトステネスのざる
ユーザー FromBooskaFromBooska
提出日時 2023-02-15 13:21:21
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 411 bytes
コンパイル時間 1,573 ms
コンパイル使用メモリ 86,640 KB
実行使用メモリ 96,720 KB
最終ジャッジ日時 2023-09-24 22:41:10
合計ジャッジ時間 6,673 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,208 KB
testcase_01 AC 74 ms
71,248 KB
testcase_02 AC 77 ms
71,348 KB
testcase_03 AC 72 ms
71,304 KB
testcase_04 AC 73 ms
71,180 KB
testcase_05 AC 73 ms
71,396 KB
testcase_06 AC 83 ms
75,192 KB
testcase_07 AC 80 ms
75,524 KB
testcase_08 AC 79 ms
75,656 KB
testcase_09 AC 79 ms
75,524 KB
testcase_10 AC 78 ms
75,692 KB
testcase_11 AC 79 ms
75,392 KB
testcase_12 AC 80 ms
75,640 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] = ((1-exe_prob)**(divisor_count(i)-2))
            
#print(is_prime)
print(sum(is_prime))
0