結果

問題 No.3296 81-like number
コンテスト
ユーザー me
提出日時 2025-10-09 10:20:24
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 127 ms / 2,000 ms
+ 730µs
コード長 354 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 403 ms
コンパイル使用メモリ 14,592 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2026-11-12 16:53:39
合計ジャッジ時間 2,712 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def is_prime(x):
    if x < 2:
        return False
    for i in range(2, int(x**0.5)+1):
        if x % i == 0:
            return False
    return True

n = int(input())

ans = set()

for i in range(2, int(n**0.5)+1):
    if is_prime(i):
        power = i * i
        while power <= n:
            ans.add(power)
            power *= i

print(sum(ans))
0