RGZN232gulujun @ 2023-11-01 20:11:30
#include<iostream>
using namespace std;
int main() {
int n,k,m;
cin>>n>>k;
m=n;
m+=n/k;
n=n%k+n/k;
while(n>k){
m+=n/k;
n%=k+n/k;
}
cout<<m;
return 0;
}
by TOLKELL @ 2023-11-18 22:09:58
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
int sum=0,ans=0;
cin>>n>>k;
sum=n,ans=n;
while(ans>=k){
sum+=ans/k;
ans=ans/k+ans%k;
}
cout<<sum;
return 0;
}