#include #define HASH 1000003 typedef struct List { struct List *next; int num; long long v; } list; int main() { long long N, K, M; scanf("%lld %lld %lld", &N, &K, &M); int h, i, n = 0, count = 0, ans = 0; long long A, B, tmp, l, r, m; list *hash[HASH] = {}, d[20000000], *p; for (A = 1; A <= 1000000; A++) { for (B = 1, tmp = A; A + B * K <= N / tmp; B++) { tmp *= A + B * K; h = tmp % HASH; for (p = hash[h]; p != NULL; p = p->next) if (p->v == tmp) break; if (p != NULL) p->num++; else { d[n].v = tmp; d[n].num = 1; l = 1000001; r = 1000000000; while (l < r) { m = (l + r) / 2; if (m * (m + K) < tmp) l = m + 1; else r = m; } if (l * (l + K) == tmp) { d[n].num++; count++; } d[n].next = hash[h]; hash[h] = &(d[n++]); } } } for (i = 0; i < n; i++) if (d[i].num == M) ans++; if (M >= 2) { printf("%d\n", ans); fflush(stdout); return 0; } l = 1000000; r = 1000000000; while (l < r) { m = (l + r + 1) / 2; if (m * (m + K) <= N) l = m; else r = m - 1; } printf("%d\n", ans - count + l - 1000000); fflush(stdout); return 0; }