#include<stdio.h>
int main()
{
int M,K,m,n;
m=0;
n=0;
scanf("%d %d",&M,&K);
if(M<K)
{
printf("%d",M);
}
else if(K!=0)
{
m=M/K;
n=m+M;
printf("%d",n);
}
else if(K=0)
{
printf("%d",M);
}
}
#include <math.h>
#include <stdio.h>
#include <string.h>
int main()
{
int M,K;
int result=0;
scanf("%d %d",&M,&K);
if(M<K)//特殊情况:你的钱根本不够优惠,你不配
{
result=M;
}else{
while (M>=K)//钱大于阈值才可参与消费赠优惠
{
M=M-K+1;
result+=K;
}
if(M!=0)//剩下的钱虽不能优惠,但还是能用
{
result+=M;
}
}
printf("%d",result);
return 0;
}