結果

問題 No.278 連続する整数の和(2)
ユーザー 👑 KazunKazun
提出日時 2020-09-05 15:06:29
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 758 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 87,112 KB
実行使用メモリ 75,588 KB
最終ジャッジ日時 2023-08-19 02:39:30
合計ジャッジ時間 2,633 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
71,292 KB
testcase_01 AC 63 ms
71,324 KB
testcase_02 AC 76 ms
75,588 KB
testcase_03 AC 60 ms
71,444 KB
testcase_04 AC 59 ms
71,288 KB
testcase_05 AC 67 ms
75,388 KB
testcase_06 AC 61 ms
71,248 KB
testcase_07 AC 61 ms
71,160 KB
testcase_08 AC 61 ms
71,332 KB
testcase_09 AC 60 ms
71,356 KB
testcase_10 AC 63 ms
75,348 KB
testcase_11 AC 65 ms
75,228 KB
testcase_12 AC 61 ms
71,216 KB
testcase_13 AC 74 ms
75,112 KB
testcase_14 AC 63 ms
75,256 KB
testcase_15 AC 67 ms
75,348 KB
testcase_16 AC 64 ms
75,396 KB
testcase_17 AC 64 ms
75,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#素因数分解
def Prime_Factorization(N):
    if N<0:
        R=[[-1,1]]
    else:
        R=[]

    N=abs(N)
    k=2
    while k*k<=N:
        if N%k==0:
            C=0
            while N%k==0:
                C+=1
                N//=k
            R.append([k,C])
        k+=1

    if N!=1:
        R.append([N,1])
    if not R:
        R.append([N,1])

    return R

#約数のK乗和
def Divisor_Sigma(N,K=1):
    if N==1:
        return 1

    H=Prime_Factorization(N)

    R=1
    if K==0:
        for (_,e) in H:
            R*=(e+1)
    else:
        for (p,e) in H:
            R*=(p**((e+1)*K)-1)//(p**K-1)
    return R
#================================================
N=int(input())

if N%2:
    A=N
else:
    A=N//2

print(Divisor_Sigma(A))
0