結果

問題 No.1791 Repeat Multiplication
ユーザー 👑 rin204rin204
提出日時 2022-01-21 01:42:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 621 ms / 3,000 ms
コード長 323 bytes
コンパイル時間 835 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 101,356 KB
最終ジャッジ日時 2023-08-16 03:45:52
合計ジャッジ時間 18,392 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,508 KB
testcase_01 AC 67 ms
71,084 KB
testcase_02 AC 89 ms
76,588 KB
testcase_03 AC 69 ms
71,444 KB
testcase_04 AC 76 ms
76,052 KB
testcase_05 AC 79 ms
75,796 KB
testcase_06 AC 69 ms
71,328 KB
testcase_07 AC 76 ms
75,788 KB
testcase_08 AC 342 ms
79,348 KB
testcase_09 AC 293 ms
79,216 KB
testcase_10 AC 286 ms
79,072 KB
testcase_11 AC 273 ms
79,088 KB
testcase_12 AC 210 ms
78,812 KB
testcase_13 AC 558 ms
99,512 KB
testcase_14 AC 570 ms
100,044 KB
testcase_15 AC 502 ms
93,964 KB
testcase_16 AC 487 ms
93,576 KB
testcase_17 AC 599 ms
100,948 KB
testcase_18 AC 517 ms
96,264 KB
testcase_19 AC 556 ms
99,324 KB
testcase_20 AC 523 ms
94,624 KB
testcase_21 AC 583 ms
98,672 KB
testcase_22 AC 618 ms
101,064 KB
testcase_23 AC 501 ms
95,120 KB
testcase_24 AC 585 ms
99,804 KB
testcase_25 AC 540 ms
98,708 KB
testcase_26 AC 575 ms
100,224 KB
testcase_27 AC 520 ms
96,176 KB
testcase_28 AC 582 ms
101,344 KB
testcase_29 AC 617 ms
101,224 KB
testcase_30 AC 621 ms
101,244 KB
testcase_31 AC 68 ms
71,116 KB
testcase_32 AC 586 ms
101,204 KB
testcase_33 AC 584 ms
101,204 KB
testcase_34 AC 584 ms
101,356 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