結果
問題 | No.2972 確率的素数判定 |
ユーザー |
![]() |
提出日時 | 2024-11-29 23:07:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 412 ms / 2,000 ms |
コード長 | 594 bytes |
コンパイル時間 | 169 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 84,224 KB |
最終ジャッジ日時 | 2024-11-29 23:07:50 |
合計ジャッジ時間 | 4,750 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
from itertools import accumulatePrimes_MAX = 10 ** 5 + 100Primes = []Sieve = [0] * Primes_MAXSieve[0] = Sieve[1] = -1for p in range(2, Primes_MAX):if not Sieve[p]:Primes.append(p)Sieve[p] = pfor q in range(p * p, Primes_MAX, p):if not Sieve[q]:Sieve[q] = pacc = [0] * Primes_MAXfor p in Primes:acc[p] += 1acc = list(accumulate(acc))for _ in range(int(input())):n, p, q = map(int, input().split())scc = acc[n] / n * p / 100fail = (1 - acc[n] / n) * (1 - q / 100)print(f'{scc / (scc + fail):.10f}')