結果

問題 No.1791 Repeat Multiplication
ユーザー qibqib
提出日時 2023-01-09 02:25:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 638 ms / 3,000 ms
コード長 352 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 87,276 KB
実行使用メモリ 101,360 KB
最終ジャッジ日時 2023-08-22 09:39:36
合計ジャッジ時間 18,849 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,128 KB
testcase_01 AC 74 ms
71,492 KB
testcase_02 AC 84 ms
76,568 KB
testcase_03 AC 74 ms
71,588 KB
testcase_04 AC 82 ms
75,972 KB
testcase_05 AC 85 ms
75,952 KB
testcase_06 AC 75 ms
71,124 KB
testcase_07 AC 82 ms
75,804 KB
testcase_08 AC 327 ms
79,272 KB
testcase_09 AC 299 ms
79,160 KB
testcase_10 AC 297 ms
79,216 KB
testcase_11 AC 284 ms
79,100 KB
testcase_12 AC 217 ms
79,052 KB
testcase_13 AC 620 ms
99,392 KB
testcase_14 AC 595 ms
100,044 KB
testcase_15 AC 513 ms
95,056 KB
testcase_16 AC 495 ms
93,612 KB
testcase_17 AC 637 ms
100,564 KB
testcase_18 AC 525 ms
96,240 KB
testcase_19 AC 559 ms
99,484 KB
testcase_20 AC 514 ms
95,304 KB
testcase_21 AC 630 ms
99,732 KB
testcase_22 AC 590 ms
100,824 KB
testcase_23 AC 508 ms
95,008 KB
testcase_24 AC 584 ms
99,900 KB
testcase_25 AC 560 ms
98,432 KB
testcase_26 AC 611 ms
100,368 KB
testcase_27 AC 526 ms
96,268 KB
testcase_28 AC 638 ms
101,260 KB
testcase_29 AC 638 ms
101,324 KB
testcase_30 AC 629 ms
101,308 KB
testcase_31 AC 71 ms
71,416 KB
testcase_32 AC 636 ms
101,308 KB
testcase_33 AC 620 ms
101,324 KB
testcase_34 AC 607 ms
101,360 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())

dp = [0 for _ in range(n + 1)]
dp[1] = 1
for x in range(2, n + 1):
  dp[x] += 1
  for y in range(2 * x, n + 1, x):
    dp[y] += dp[x]

ans = [0 for _ in range(n + 1)]
for x in range(1, n + 1):
  for y in range(1, n // x + 1):
    ans[x] += dp[y]
  ans[x] *= dp[x]

for _ in range(q):
  x = int(input())
  print(ans[x])
0