mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
ed2de2e423
1500-1599
18 lines
277 B
C++
18 lines
277 B
C++
#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;
|
|
}
|