結果

問題 No.1791 Repeat Multiplication
ユーザー 👑 SPD_9X2SPD_9X2
提出日時 2021-12-23 22:17:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 467 ms / 3,000 ms
コード長 574 bytes
コンパイル時間 1,355 ms
コンパイル使用メモリ 81,548 KB
実行使用メモリ 105,268 KB
最終ジャッジ日時 2023-10-18 00:06:44
合計ジャッジ時間 12,775 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,424 KB
testcase_01 AC 36 ms
53,424 KB
testcase_02 AC 50 ms
64,244 KB
testcase_03 AC 37 ms
53,424 KB
testcase_04 AC 42 ms
59,404 KB
testcase_05 AC 43 ms
59,404 KB
testcase_06 AC 37 ms
53,424 KB
testcase_07 AC 42 ms
59,404 KB
testcase_08 AC 114 ms
83,068 KB
testcase_09 AC 109 ms
82,984 KB
testcase_10 AC 107 ms
82,976 KB
testcase_11 AC 104 ms
82,920 KB
testcase_12 AC 84 ms
79,672 KB
testcase_13 AC 423 ms
103,356 KB
testcase_14 AC 432 ms
103,676 KB
testcase_15 AC 302 ms
97,512 KB
testcase_16 AC 296 ms
97,400 KB
testcase_17 AC 444 ms
104,276 KB
testcase_18 AC 341 ms
101,876 KB
testcase_19 AC 376 ms
103,744 KB
testcase_20 AC 305 ms
98,512 KB
testcase_21 AC 374 ms
103,412 KB
testcase_22 AC 417 ms
104,436 KB
testcase_23 AC 324 ms
99,392 KB
testcase_24 AC 397 ms
103,596 KB
testcase_25 AC 371 ms
103,280 KB
testcase_26 AC 400 ms
103,972 KB
testcase_27 AC 327 ms
101,856 KB
testcase_28 AC 437 ms
105,256 KB
testcase_29 AC 455 ms
105,132 KB
testcase_30 AC 448 ms
105,268 KB
testcase_31 AC 35 ms
53,424 KB
testcase_32 AC 452 ms
105,260 KB
testcase_33 AC 467 ms
105,260 KB
testcase_34 AC 451 ms
105,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""

dpL[x] = xがある時、その左としてあり得る種類数
dpR[x] = xがある時、その右としてあり得る種類数

log
行けるかな…

"""

import sys
from sys import stdin

N,Q = map(int,stdin.readline().split())

dpL = [0] * (N+1)
dpL[1] = 1

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

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

ans = []

for loop in range(Q):

    x = int(stdin.readline())
    ans.append( str(dpL[x]*dpR[x]) )

print ("\n".join(ans))
0