結果
| 問題 | 
                            No.1383 Numbers of Product
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-12-15 19:45:31 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 934 bytes | 
| コンパイル時間 | 165 ms | 
| コンパイル使用メモリ | 82,432 KB | 
| 実行使用メモリ | 144,972 KB | 
| 最終ジャッジ日時 | 2024-07-04 11:04:43 | 
| 合計ジャッジ時間 | 4,062 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 TLE * 1 -- * 45 | 
ソースコード
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)