imbecile @ 2021-06-23 17:32:14
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
int sum=n;
while(n-k>0)
{
sum++;
n-=k;
n++;
}
cout<<sum;
}
by _Haoomff_ @ 2021-06-23 17:37:37
将
while(n-k>0)
{
sum++;
n-=k;
n++;
}
改为
while(n>=k)
{
sum+=n/k;
n=n%k+n/k;
}
by imbecile @ 2021-06-23 17:50:25
@L_YALONG 谢谢