Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.cpp
- // AndeyLess
- //
- // Created by Kadir Kadyrov on 08.07.2020.
- // Copyright © 2020 Kadir Kadyrov. All rights reserved.
- //
- #include <iostream>
- #include <vector>
- #include <queue>
- #include <algorithm>
- using namespace std;
- int main() {
- int a, b;
- cin >> a >> b;
- int curr = a, ans = 0, currB = 0;
- while(curr > 0) {
- ans += curr;
- currB += curr;
- curr = currB / b;
- currB %= b;
- }
- cout << ans << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement