結果

問題 No.144 エラトステネスのざる
ユーザー lllllll88938494lllllll88938494
提出日時 2022-06-27 20:53:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 251 ms / 2,000 ms
コード長 165 bytes
コンパイル時間 1,173 ms
コンパイル使用メモリ 86,920 KB
実行使用メモリ 99,980 KB
最終ジャッジ日時 2023-08-12 12:36:54
合計ジャッジ時間 5,374 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,432 KB
testcase_01 AC 74 ms
71,204 KB
testcase_02 AC 76 ms
71,512 KB
testcase_03 AC 73 ms
71,524 KB
testcase_04 AC 74 ms
71,424 KB
testcase_05 AC 72 ms
71,472 KB
testcase_06 AC 81 ms
75,976 KB
testcase_07 AC 77 ms
75,932 KB
testcase_08 AC 81 ms
76,136 KB
testcase_09 AC 81 ms
75,968 KB
testcase_10 AC 79 ms
76,076 KB
testcase_11 AC 79 ms
76,016 KB
testcase_12 AC 78 ms
75,884 KB
testcase_13 AC 243 ms
99,604 KB
testcase_14 AC 251 ms
99,844 KB
testcase_15 AC 249 ms
99,884 KB
testcase_16 AC 243 ms
99,820 KB
testcase_17 AC 246 ms
99,980 KB
testcase_18 AC 247 ms
99,660 KB
testcase_19 AC 251 ms
99,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,p=input().split()
n=int(n)
p=float(p)
a=[1]*(n+1)

for i in range(2,n):
    t=i*2
    while t <= n:
        a[t] *= (1-p)
        t+=i
        
print(sum(a[2:]))

0