#33372: peter boo


yp11151138@yphs.tp.edu.tw (908-33許劭頎)

學校 : 臺北市私立延平高級中學
編號 : 197089
來源 : [203.72.178.1]
最後登入時間 :
2025-06-13 17:36:28

#include<bits/stdc++.h>
using namespace std;

int main(){
    int n,k,sum;
    while(cin>>n>>k){
        sum=n;
        while(n>=k){
            sum+=(n/k);
            n=(n/k)+(n%k);
        }
        cout<<sum<<endl;
    }
    return 0;
}