1
0
mirror of https://github.com/Kiritow/OJ-Problems-Source.git synced 2024-03-22 13:11:29 +08:00

18 lines
277 B
C++
Raw Normal View History

#include<stdio.h>
int main()
{
int m,k;
while(scanf("%d%d",&m,&k)!=EOF&&m&&k)
{
int sum=0;
while(m-k>=0)
{
sum+=k;
m=m-k+1;
}
sum+=m;
printf("%d\n",sum);
}
return 0;
}