結果

問題 No.1791 Repeat Multiplication
ユーザー rin204rin204
提出日時 2022-01-21 01:42:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 588 ms / 3,000 ms
コード長 323 bytes
コンパイル時間 882 ms
コンパイル使用メモリ 82,592 KB
実行使用メモリ 100,640 KB
最終ジャッジ日時 2024-05-03 13:16:32
合計ジャッジ時間 15,423 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,692 KB
testcase_01 AC 36 ms
52,444 KB
testcase_02 AC 46 ms
62,720 KB
testcase_03 AC 33 ms
53,296 KB
testcase_04 AC 41 ms
61,536 KB
testcase_05 AC 44 ms
61,284 KB
testcase_06 AC 34 ms
53,896 KB
testcase_07 AC 40 ms
60,776 KB
testcase_08 AC 276 ms
78,304 KB
testcase_09 AC 280 ms
78,024 KB
testcase_10 AC 280 ms
77,932 KB
testcase_11 AC 258 ms
77,888 KB
testcase_12 AC 190 ms
77,272 KB
testcase_13 AC 573 ms
98,232 KB
testcase_14 AC 496 ms
99,216 KB
testcase_15 AC 420 ms
92,752 KB
testcase_16 AC 477 ms
92,572 KB
testcase_17 AC 588 ms
99,336 KB
testcase_18 AC 475 ms
95,012 KB
testcase_19 AC 556 ms
98,136 KB
testcase_20 AC 457 ms
93,312 KB
testcase_21 AC 549 ms
97,944 KB
testcase_22 AC 511 ms
99,468 KB
testcase_23 AC 475 ms
93,748 KB
testcase_24 AC 508 ms
98,524 KB
testcase_25 AC 485 ms
97,052 KB
testcase_26 AC 513 ms
98,944 KB
testcase_27 AC 440 ms
94,964 KB
testcase_28 AC 503 ms
100,272 KB
testcase_29 AC 505 ms
100,028 KB
testcase_30 AC 494 ms
99,824 KB
testcase_31 AC 34 ms
52,980 KB
testcase_32 AC 505 ms
100,040 KB
testcase_33 AC 517 ms
100,640 KB
testcase_34 AC 501 ms
100,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, q = map(int, input().split())
bef = [1] * (n + 1)
aft = [1] * (n + 1)

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

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

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