結果

問題 No.1383 Numbers of Product
ユーザー MitarushiMitarushi
提出日時 2020-12-15 19:45:31
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 934 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 152,308 KB
最終ジャッジ日時 2023-09-17 16:10:01
合計ジャッジ時間 4,644 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
75,968 KB
testcase_01 AC 72 ms
71,372 KB
testcase_02 AC 76 ms
71,152 KB
testcase_03 AC 73 ms
71,336 KB
testcase_04 AC 73 ms
71,100 KB
testcase_05 AC 76 ms
71,324 KB
testcase_06 AC 75 ms
71,248 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, k, m = map(int, input().split())


def max2(x):
    ok = 0
    ng = 10**9
    while ng - ok > 1:
        m = (ok + ng) // 2
        if m * (m + k) <= x:
            ok = m
        else:
            ng = m
    return ok


def sqrt(x):
    s = 1
    while True:
        s = (x//s+s)//2
        if s**2 <= x < (s+1)**2:
            return s


def is_2(x):
    t = k**2 + x * 4
    r = sqrt(t)
    if t != r**2:
        return False
    y = (-k + r) // 2
    return y*(y+k) == x


big2 = {}
for b in range(3, 20):
    i = 1
    while True:
        x = 1
        for j in range(b):
            x *= i + j * k
        if x > n:
            break
        if x in big2:
            big2[x] += 1
        else:
            big2[x] = 1
        i += 1

count_2 = max2(n)
for i in big2:
    if is_2(i):
        big2[i] += 1
        count_2 -= 1

ans = count_2 if m == 1 else 0
for i in big2.values():
    if i == m:
        ans += 1
print(ans)
0