喜欢卡卡西 @ 2017-09-10 12:16:22
#include<stdio.h>
int main()
{
long int n,k,s=0;
scanf("%ld %ld",&n,&k);
while(n)
{
s+=n;
n/=k;
}
printf("%ld",s);
}
我思路不对么》》??qwq
by Monster_Qi @ 2017-09-30 17:52:02
#include<iostream>
#include<cstdio>
using namespace std;
int n,k,cnt,p;
int main()
{
cin>>n>>k;
while(1)
{
if(n>0)
{
n--;
cnt++;
p++;
}
if(p==k)
{
n++;
p=0;
}
if(n==0&&p<k)
break;
}
cout<<cnt<<endl;
}