#include<stdio.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
int n,m,k,ans;
while(~scanf("%d%d",&n,&k))
{
ans=0;
m=0;
ans=n;
m=n;
while(n>=k)
{
m=n/k;
ans+=n/k;
n=n%k;
n+=m;
}
printf("%d
",ans);
}
return 0;
}
版权声明:本文为博主原创文章,未经博主允许不得转载。http://xiang578.top/