結果

問題 No.2480 Sequence Sum
ユーザー misonikomipan
提出日時 2023-09-22 23:44:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 31 ms / 500 ms
コード長 520 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-07-26 14:41:22
合計ジャッジ時間 1,130 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
import math


def prime_factorization(num: int) -> defaultdict:
    d = defaultdict(int)
    for n in range(2, math.ceil(math.sqrt(num)) + 2):
        while not (num % n):
            num //= n
            d[n] += 1
    if num > 1:
        d[num] += 1
    return d

# N % m == 0のとき,m分割できないので,
# N % m != 0を満たすmの個数っぽくね?
N = int(input())
f = prime_factorization(N)
yakusu = 1
for k, v in f.items():
    yakusu *= v + 1
print(N - yakusu)
0