結果
| 問題 | No.3691 Calculate Mu Sum |
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2026-09-06 21:51:02 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1,376 ms / 2,000 ms |
| + 755µs | |
| コード長 | 573 bytes |
| 記録 | |
| コンパイル時間 | 260 ms |
| コンパイル使用メモリ | 95,952 KB |
| 実行使用メモリ | 396,160 KB |
| 最終ジャッジ日時 | 2026-09-06 21:51:11 |
| 合計ジャッジ時間 | 7,405 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
class Eratosthenes:
def __init__(self, n):
self.isPrime = [True]*(n+1)
self.isPrime[0], self.isPrime[1] = False, False
self.mobius = [1]*(n+1)
for i in range(2, n+1):
if self.isPrime[i]:
self.mobius[i] = -1
for j in range(i*2, n+1, i):
self.isPrime[j] = False
if j//i%i == 0:
self.mobius[j] = 0
else:
self.mobius[j] *= -1
N = int(input())
E = Eratosthenes(N)
print(sum(E.mobius[1:]))
detteiuu