結果

問題 No.1791 Repeat Multiplication
ユーザー roarisroaris
提出日時 2022-02-14 18:53:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 594 ms / 3,000 ms
コード長 349 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 101,064 KB
最終ジャッジ日時 2023-09-11 16:46:00
合計ジャッジ時間 15,347 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,080 KB
testcase_01 AC 73 ms
71,388 KB
testcase_02 AC 84 ms
76,192 KB
testcase_03 AC 72 ms
71,104 KB
testcase_04 AC 77 ms
75,616 KB
testcase_05 AC 81 ms
75,720 KB
testcase_06 AC 74 ms
71,244 KB
testcase_07 AC 79 ms
75,768 KB
testcase_08 AC 145 ms
79,352 KB
testcase_09 AC 140 ms
79,488 KB
testcase_10 AC 138 ms
78,732 KB
testcase_11 AC 138 ms
79,264 KB
testcase_12 AC 126 ms
78,708 KB
testcase_13 AC 461 ms
100,024 KB
testcase_14 AC 470 ms
99,928 KB
testcase_15 AC 324 ms
93,708 KB
testcase_16 AC 319 ms
93,432 KB
testcase_17 AC 496 ms
100,556 KB
testcase_18 AC 381 ms
95,764 KB
testcase_19 AC 439 ms
98,916 KB
testcase_20 AC 365 ms
94,068 KB
testcase_21 AC 423 ms
98,476 KB
testcase_22 AC 517 ms
100,656 KB
testcase_23 AC 401 ms
94,764 KB
testcase_24 AC 526 ms
99,960 KB
testcase_25 AC 449 ms
97,976 KB
testcase_26 AC 556 ms
100,276 KB
testcase_27 AC 436 ms
95,756 KB
testcase_28 AC 552 ms
100,948 KB
testcase_29 AC 560 ms
100,888 KB
testcase_30 AC 562 ms
100,932 KB
testcase_31 AC 72 ms
71,088 KB
testcase_32 AC 594 ms
100,724 KB
testcase_33 AC 538 ms
100,888 KB
testcase_34 AC 488 ms
101,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, Q = map(int, input().split())
dp1 = [0]*(N+1)
dp1[1] = 1

for i in range(1, N):
    for j in range(2*i, N+1, i):
        dp1[j] += dp1[i]

dp2 = [1]*(N+1)

for i in range(N-1, 0, -1):
    for j in range(2*i, N+1, i):
        dp2[i] += dp2[j]

for _ in range(Q):
    x = int(input())
    print(dp1[x]*dp2[x])
0