結果

問題 No.1581 Multiple Sequence
ユーザー Kiri8128Kiri8128
提出日時 2021-07-02 23:12:40
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 738 bytes
コンパイル時間 802 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 90,484 KB
最終ジャッジ日時 2023-09-11 23:39:30
合計ジャッジ時間 9,104 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
72,632 KB
testcase_01 AC 74 ms
72,152 KB
testcase_02 AC 396 ms
86,632 KB
testcase_03 AC 414 ms
87,060 KB
testcase_04 AC 249 ms
81,912 KB
testcase_05 AC 424 ms
87,448 KB
testcase_06 AC 294 ms
83,780 KB
testcase_07 AC 245 ms
81,972 KB
testcase_08 AC 274 ms
83,032 KB
testcase_09 AC 406 ms
86,548 KB
testcase_10 AC 335 ms
84,380 KB
testcase_11 AC 210 ms
80,708 KB
testcase_12 AC 281 ms
82,976 KB
testcase_13 AC 123 ms
78,936 KB
testcase_14 AC 422 ms
87,300 KB
testcase_15 AC 358 ms
85,384 KB
testcase_16 AC 219 ms
81,008 KB
testcase_17 AC 445 ms
87,788 KB
testcase_18 AC 190 ms
80,828 KB
testcase_19 AC 389 ms
86,040 KB
testcase_20 AC 401 ms
86,464 KB
testcase_21 AC 416 ms
87,036 KB
testcase_22 AC 314 ms
84,292 KB
testcase_23 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def primeFactor(N):
    i, n, ret, d, sq = 2, N, {}, 2, 99
    while i <= sq:
        k = 0
        while n % i == 0: n, k, ret[i] = n//i, k+1, k+1
        if k > 0 or i == 97: sq = int(n**(1/2)+0.5)
        if i < 4: i = i * 2 - 1
        else: i, d = i+d, d^6
    if n > 1: ret[n] = 1
    return ret

def divisors(N):
    pf = primeFactor(N)
    ret = [1]
    for p in pf:
        ret_prev = ret
        ret = []
        for i in range(pf[p]+1):
            for r in ret_prev:
                ret.append(r * (p ** i))
    return sorted(ret)

N = int(input())
X = [0] * 10 ** 5
X[0] = X[1] = 1
for i in range(2, N + 1):
    a = 0
    for d in divisors(i):
        b = i // d - 1
        a += X[b]
    X[i] = a
print(X[N] % (10 ** 9 + 7))
0