1 solutions

  • 1
    @ 2026-9-25 14:36:08
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    int main(){
        ll n,k;
        cin>>n>>k;
        ll ans=n,butt=n;
        while (butt>=k) {
            ll t=butt/k;
            ans+=t;
            butt=butt%k+t;
        }
        cout<<ans<<endl;
        return 0;
    }
    

    Information

    ID
    284
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    59
    Accepted
    18
    Uploaded By