计算机纪逸强 @ 2019-03-16 21:24:37
int main() { int n; long k; scanf("%d%ld",&n,&k); int count=n; int temp=n; while(temp-k>=0) { count=count+temp/k; temp=temp/k; } printf("%d",count); return 0; }
by DARKSTALKING @ 2019-03-16 21:30:40
希望得到更精彩的表现,使用Markdowm
by DARKSTALKING @ 2019-03-16 21:31:05
@wudiWIPE 不要总是强调头文件
by DARKSTALKING @ 2019-03-16 21:40:54
@wudiWIPE 程序为啥没有申明空间?
by DARKSTALKING @ 2019-03-16 21:43:04
@wudiWIPE
#include<bits/stdc++.h>
using namespace std;
int n,k,d,ans;
int main()
{
cin>>n>>k;
for(int i=1;;i++)
{
if(n==0&&d<k)
{
cout<<ans;
return 0;
}
ans+=1;
n-=1;
d+=1;
if(d==k)
n+=1,d=0;
}
return 0;
}
这是我N年以前的丑陋代码,以供参考
by 计算机纪逸强 @ 2019-03-17 09:33:57
@DARKSTALKING 好的谢谢