結果

問題 No.1737 One to N
ユーザー kohei2019kohei2019
提出日時 2023-06-11 23:56:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 1,201 ms
コンパイル使用メモリ 86,936 KB
実行使用メモリ 71,948 KB
最終ジャッジ日時 2023-09-01 03:32:29
合計ジャッジ時間 7,214 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
71,560 KB
testcase_01 AC 119 ms
71,848 KB
testcase_02 AC 89 ms
71,756 KB
testcase_03 AC 120 ms
71,796 KB
testcase_04 AC 129 ms
71,852 KB
testcase_05 AC 113 ms
71,872 KB
testcase_06 AC 102 ms
71,472 KB
testcase_07 AC 107 ms
71,796 KB
testcase_08 AC 133 ms
71,752 KB
testcase_09 AC 89 ms
71,696 KB
testcase_10 AC 104 ms
71,752 KB
testcase_11 AC 125 ms
71,664 KB
testcase_12 AC 102 ms
71,708 KB
testcase_13 AC 93 ms
71,704 KB
testcase_14 AC 136 ms
71,752 KB
testcase_15 AC 138 ms
71,768 KB
testcase_16 AC 135 ms
71,748 KB
testcase_17 AC 129 ms
71,744 KB
testcase_18 AC 95 ms
71,472 KB
testcase_19 AC 92 ms
71,720 KB
testcase_20 AC 83 ms
71,876 KB
testcase_21 AC 114 ms
71,504 KB
testcase_22 AC 95 ms
71,588 KB
testcase_23 AC 120 ms
71,724 KB
testcase_24 AC 142 ms
71,948 KB
testcase_25 AC 70 ms
71,476 KB
testcase_26 AC 70 ms
71,732 KB
testcase_27 AC 69 ms
71,632 KB
testcase_28 AC 70 ms
71,872 KB
testcase_29 AC 69 ms
71,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def factorization(N):#素因数分解√N
    arr = []
    temp = N
    for i in range(2, int(-(-N**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([N, 1])
    return arr #[素因数、個数]
N = int(input())

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

ar = factorization(N)

ans = 0

for a,b in ar:
    ans += a * b

print(ans)
0