結果
問題 | No.144 エラトステネスのざる |
ユーザー | maspy |
提出日時 | 2020-01-01 19:16:56 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 456 bytes |
コンパイル時間 | 113 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 55,992 KB |
最終ジャッジ日時 | 2024-05-02 05:08:02 |
合計ジャッジ時間 | 14,270 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 575 ms
44,208 KB |
testcase_03 | AC | 564 ms
44,344 KB |
testcase_04 | AC | 567 ms
44,084 KB |
testcase_05 | AC | 564 ms
44,336 KB |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 560 ms
44,220 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 593 ms
55,868 KB |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import numpy as np N,p = read().split() N = int(N); p = float(p) div_cnt = np.zeros(N+1,np.int32) for x in range(1,int(N**.5)+10): if x * x > N: break div_cnt[x*x] += 1 div_cnt[x*(x+1):N+1:x] += 2 div_cnt -= 2 counter = np.bincount(div_cnt[2:]) answer = sum(p ** i * x for i,x in enumerate(counter)) print(answer)