結果
問題 | No.144 エラトステネスのざる |
ユーザー | nohtaray |
提出日時 | 2019-06-14 14:39:47 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 341 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 64,788 KB |
最終ジャッジ日時 | 2024-04-25 08:17:24 |
合計ジャッジ時間 | 30,494 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 573 ms
44,060 KB |
testcase_01 | AC | 552 ms
43,812 KB |
testcase_02 | AC | 559 ms
44,324 KB |
testcase_03 | AC | 550 ms
44,184 KB |
testcase_04 | AC | 553 ms
44,320 KB |
testcase_05 | AC | 554 ms
44,324 KB |
testcase_06 | AC | 553 ms
43,936 KB |
testcase_07 | AC | 559 ms
43,808 KB |
testcase_08 | AC | 568 ms
44,156 KB |
testcase_09 | AC | 638 ms
43,932 KB |
testcase_10 | AC | 567 ms
44,200 KB |
testcase_11 | AC | 568 ms
43,808 KB |
testcase_12 | AC | 570 ms
43,800 KB |
testcase_13 | TLE | - |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
ソースコード
import sys import numpy as np sys.setrecursionlimit(2147483647) INF = float("inf") IN = sys.stdin.readline().rstrip().split() N = int(IN[0]) P = float(IN[1]) # 列挙される期待値=(1-p)^約数の数 sieve = np.zeros(N + 1) for n in range(2, N // 2 + 1): sieve[np.arange(n * 2, N + 1, n)] += 1 print(pow(1 - P, sieve[2:]).sum())