#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef unsigned long long ll; const ll mod = 1000000007; const ll INF = (ll)1000000007 * 1000000007; typedef pair P; #define rep(i,n) for(int i=0;i=0;i--) #define Rep(i,sta,n) for(int i=sta;i=sta;i--) typedef long double ld; const ld eps = 1e-8; const ld pi = acos(-1.0); typedef pair LP; int dx[4]={1,-1,0,0}; int dy[4]={0,0,1,-1}; templatebool chmax(T &a, const T &b) {if(abool chmin(T &a, const T &b) {if(b ma; ll Kth_root(ll x,int k){ if(x==1) return 1; if(k>64) return 1; ll l=0,r=numeric_limits::max(); while(r-l>1){ ll mid=(l+r)/(ll)2; ll d=mid; bool larger=false; rep(i,k-1){ if(d>x/mid+(ll)1){ larger=true; break; } d*=mid; } if(d>x) larger=true; if(larger) r=mid; else l=mid; } return l; } void solve(){ cin >> N >> K >> M; Rep(i,2,35){ ll A=1; while(true){ ll Z=1; bool flag=false; rep(j,i+1){ Z*=A+j*K; if(Z>N) { flag=true; break; } } if(flag) break; ma[Z]++; A++; } } ll ans=0; if(M==1){ ll l=0,r=mod; while(r-l>1){ ll mid=(l+r)/2; if(mid*(mid+K)>N) r=mid; else l=mid; } //cout << l << " " << l*(l+K) << endl; ans+=l; } for(auto p:ma){ bool f=false; ll l=0,r=mod; while(r-l>1){ ll mid=(l+r)/2; if(mid*(mid+K)>p.first) r=mid; else l=mid; } //cout << p.first << " " << p.second << " " << l << " " << l*(l+K) << endl; if(l*(l+K)==p.first) f=true; cout << f+p.second << endl; if(f+p.second==M) ans++; if(M==1 && f) if(p.second>=1) { ans--; } } cout << ans << endl; } int main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(50); solve(); }