結果

問題 No.1791 Repeat Multiplication
ユーザー yvay5cqeyvay5cqe
提出日時 2022-01-14 15:44:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 527 ms / 3,000 ms
コード長 354 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 86,812 KB
実行使用メモリ 89,456 KB
最終ジャッジ日時 2023-08-12 09:02:25
合計ジャッジ時間 16,041 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,064 KB
testcase_01 AC 72 ms
71,252 KB
testcase_02 AC 80 ms
76,196 KB
testcase_03 AC 73 ms
71,084 KB
testcase_04 AC 80 ms
75,452 KB
testcase_05 AC 83 ms
75,552 KB
testcase_06 AC 73 ms
71,088 KB
testcase_07 AC 81 ms
75,496 KB
testcase_08 AC 329 ms
78,400 KB
testcase_09 AC 295 ms
78,216 KB
testcase_10 AC 293 ms
78,324 KB
testcase_11 AC 280 ms
78,488 KB
testcase_12 AC 211 ms
77,928 KB
testcase_13 AC 476 ms
88,344 KB
testcase_14 AC 509 ms
88,584 KB
testcase_15 AC 431 ms
85,784 KB
testcase_16 AC 443 ms
85,316 KB
testcase_17 AC 527 ms
88,956 KB
testcase_18 AC 464 ms
87,328 KB
testcase_19 AC 503 ms
88,152 KB
testcase_20 AC 445 ms
87,240 KB
testcase_21 AC 495 ms
88,020 KB
testcase_22 AC 512 ms
89,172 KB
testcase_23 AC 449 ms
86,908 KB
testcase_24 AC 492 ms
88,644 KB
testcase_25 AC 472 ms
88,168 KB
testcase_26 AC 496 ms
88,860 KB
testcase_27 AC 456 ms
87,200 KB
testcase_28 AC 507 ms
89,208 KB
testcase_29 AC 508 ms
89,456 KB
testcase_30 AC 506 ms
89,380 KB
testcase_31 AC 70 ms
71,092 KB
testcase_32 AC 507 ms
89,208 KB
testcase_33 AC 496 ms
89,180 KB
testcase_34 AC 505 ms
89,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, Q = map(int, input().split())

dp = [0]*(N+1)
dp[0] = dp[1] = 1
for i in range(1, N+1):
    for j in range(i << 1, N+1, i):
        dp[j] += dp[i]


def calc(x):
    base = dp[x]  # x で終わるやつ
    ret = 0
    for y in range(1, N//x+1):
        ret += dp[y] * base

    return ret


for _ in range(Q):
    x = int(input())
    print(calc(x))
0