星宇,不曾 @ 2020-10-30 12:43:23
写了递归的思想
#include<bits/stdc++.h>
using namespace std;
int k=0,i=0;
int f(int q)
{
if(q<3) return q;
else i=q%k; return f(q/k+i)+q;
}
int main()
{
int n;
cin>>n>>k;
cout<<f(n)-1;
}
by Fearliciz @ 2020-11-25 15:59:27
@fwx123456 超时了吧