結果

問題 No.1737 One to N
ユーザー dango
提出日時 2023-06-25 14:44:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 417 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 53,828 KB
最終ジャッジ日時 2024-07-02 13:17:59
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    if n == 1:
        print(0)
        return
    ans = 0
    a = prime_factors(n)
    for i in range(len(a)):
        ans += a[i]
    print(ans)
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors
main()
0