結果

問題 No.1791 Repeat Multiplication
ユーザー yvay5cqeyvay5cqe
提出日時 2022-01-14 15:44:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 540 ms / 3,000 ms
コード長 354 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 88,320 KB
最終ジャッジ日時 2024-04-29 23:28:43
合計ジャッジ時間 14,310 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
51,712 KB
testcase_01 AC 43 ms
51,840 KB
testcase_02 AC 51 ms
60,416 KB
testcase_03 AC 42 ms
52,096 KB
testcase_04 AC 53 ms
59,904 KB
testcase_05 AC 56 ms
60,928 KB
testcase_06 AC 44 ms
52,352 KB
testcase_07 AC 52 ms
59,904 KB
testcase_08 AC 310 ms
77,568 KB
testcase_09 AC 288 ms
77,184 KB
testcase_10 AC 286 ms
77,440 KB
testcase_11 AC 270 ms
77,312 KB
testcase_12 AC 198 ms
77,312 KB
testcase_13 AC 493 ms
87,424 KB
testcase_14 AC 505 ms
87,552 KB
testcase_15 AC 439 ms
84,608 KB
testcase_16 AC 425 ms
84,480 KB
testcase_17 AC 519 ms
87,808 KB
testcase_18 AC 459 ms
86,272 KB
testcase_19 AC 499 ms
86,912 KB
testcase_20 AC 437 ms
84,736 KB
testcase_21 AC 509 ms
87,040 KB
testcase_22 AC 500 ms
88,064 KB
testcase_23 AC 442 ms
84,864 KB
testcase_24 AC 495 ms
87,424 KB
testcase_25 AC 487 ms
86,656 KB
testcase_26 AC 502 ms
87,680 KB
testcase_27 AC 469 ms
86,528 KB
testcase_28 AC 540 ms
88,320 KB
testcase_29 AC 535 ms
88,192 KB
testcase_30 AC 536 ms
87,936 KB
testcase_31 AC 40 ms
51,712 KB
testcase_32 AC 517 ms
87,936 KB
testcase_33 AC 524 ms
87,936 KB
testcase_34 AC 519 ms
88,192 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