結果

問題 No.1737 One to N
コンテスト
ユーザー gr1msl3y
提出日時 2021-11-12 21:26:23
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 478 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 210 ms
コンパイル使用メモリ 84,992 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2026-05-20 02:26:16
合計ジャッジ時間 3,189 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N = int(input())
if N == 1:
    print(0)
    exit()


def factorization(n):
    if n == 1:
        return [[1, 1]]
    temp = n
    ans = []
    for i in range(2, int(n**0.5+1.01)):
        if temp % i == 0:
            ct = 0
            while temp % i == 0:
                temp //= i
                ct += 1
            ans.append([i, ct])
    if temp != 1:
        ans.append([temp, 1])
    return ans


d = factorization(N)
ans = 0
for p, c in d:
    ans += p*c
print(ans)
0