結果

問題 No.3296 81-like number
ユーザー hir355
提出日時 2025-10-05 13:38:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 52 ms / 2,000 ms
コード長 268 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,236 KB
実行使用メモリ 65,700 KB
最終ジャッジ日時 2025-10-05 13:39:49
合計ジャッジ時間 1,785 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = 2
d = [1] * min(n, 10 ** 5 + 1)
ans = 0
while a * a <= n:
    if not d[a]:
        a += 1
        continue
    for j in range(a * 2, len(d), a):
        d[j] = 0
    t = a * a
    while t <= n:
        ans += t
        t *= a
    a += 1
print(ans)
0