結果
| 問題 |
No.2972 確率的素数判定
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-11-29 22:45:14 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 880 ms / 2,000 ms |
| コード長 | 449 bytes |
| コンパイル時間 | 97 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 15,400 KB |
| 最終ジャッジ日時 | 2024-11-29 22:45:23 |
| 合計ジャッジ時間 | 7,573 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
N = 100000
def Eratosthenes():
isPrime = [False] * 2 + [True] * (N-1)
i = 2
while i * i <= N:
if isPrime[i]:
for j in range(2*i, N+1, i):
isPrime[j] = False
i += 1
return isPrime
isPrime = Eratosthenes()
S = [0]
for i in range(1, N+1):
S.append(S[-1]+isPrime[i])
for t in range(int(input())):
n, p, q = map(int, input().split())
print(S[n]*p / (S[n]*p + (n-S[n])*(100-q)))