結果

問題 No.1383 Numbers of Product
ユーザー KudeKude
提出日時 2021-02-11 16:24:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,037 ms / 2,000 ms
コード長 875 bytes
コンパイル時間 227 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 201,136 KB
最終ジャッジ日時 2024-05-02 10:26:38
合計ジャッジ時間 29,451 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
60,032 KB
testcase_01 AC 54 ms
60,032 KB
testcase_02 AC 54 ms
60,544 KB
testcase_03 AC 76 ms
76,032 KB
testcase_04 AC 84 ms
75,776 KB
testcase_05 AC 81 ms
75,648 KB
testcase_06 AC 77 ms
75,648 KB
testcase_07 AC 654 ms
138,496 KB
testcase_08 AC 632 ms
138,240 KB
testcase_09 AC 783 ms
165,196 KB
testcase_10 AC 1,004 ms
187,876 KB
testcase_11 AC 993 ms
187,628 KB
testcase_12 AC 1,011 ms
187,880 KB
testcase_13 AC 947 ms
187,488 KB
testcase_14 AC 810 ms
166,380 KB
testcase_15 AC 668 ms
138,748 KB
testcase_16 AC 986 ms
187,496 KB
testcase_17 AC 93 ms
75,648 KB
testcase_18 AC 92 ms
76,032 KB
testcase_19 AC 93 ms
76,160 KB
testcase_20 AC 93 ms
75,648 KB
testcase_21 AC 93 ms
76,160 KB
testcase_22 AC 92 ms
75,648 KB
testcase_23 AC 92 ms
75,776 KB
testcase_24 AC 92 ms
75,776 KB
testcase_25 AC 92 ms
75,904 KB
testcase_26 AC 92 ms
75,648 KB
testcase_27 AC 135 ms
75,904 KB
testcase_28 AC 146 ms
77,824 KB
testcase_29 AC 796 ms
165,724 KB
testcase_30 AC 1,026 ms
188,148 KB
testcase_31 AC 108 ms
75,776 KB
testcase_32 AC 265 ms
96,152 KB
testcase_33 AC 107 ms
75,904 KB
testcase_34 AC 137 ms
76,160 KB
testcase_35 AC 926 ms
181,488 KB
testcase_36 AC 879 ms
181,228 KB
testcase_37 AC 985 ms
188,048 KB
testcase_38 AC 988 ms
188,176 KB
testcase_39 AC 987 ms
187,792 KB
testcase_40 AC 1,010 ms
187,920 KB
testcase_41 AC 976 ms
188,020 KB
testcase_42 AC 1,037 ms
188,024 KB
testcase_43 AC 1,021 ms
188,272 KB
testcase_44 AC 1,030 ms
188,024 KB
testcase_45 AC 1,023 ms
188,024 KB
testcase_46 AC 93 ms
75,776 KB
testcase_47 AC 1,014 ms
200,780 KB
testcase_48 AC 1,034 ms
201,136 KB
testcase_49 AC 1,001 ms
200,028 KB
testcase_50 AC 1,033 ms
200,980 KB
testcase_51 AC 94 ms
75,648 KB
testcase_52 AC 92 ms
75,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
n, k, m = map(int, input().split())
c = Counter()
for s in range(1, 10 ** 6 + 1):
    now = 1
    for i in range(100):
        now *= s + i * k
        if now > n:
            break
        if i >= 2:
            c[now] += 1

def g(x):
    # a(a+k) = x
    if 1 + k > x:
        return False
    l = 1
    r = 10 ** 9
    while r - l > 1:
        c = (r + l) // 2
        if c * (c + k) <= x:
            l = c
        else:
            r = c
    return l * (l + k) == x

ans = 0
for x, cnt in c.items():
    if g(x):
        if m == 1:
            ans -= 1
        elif cnt + 1 == m:
            ans += 1
    elif cnt == m:
        ans += 1

if m == 1 and 1 + k <= n:
    l = 1
    r = 10 ** 9
    while r - l > 1:
        c = (r + l) // 2
        if c * (c + k) <= n:
            l = c
        else:
            r = c
    ans += l
print(ans)
0