Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Codeforces Round 379A
- #include <iostream>
- using namespace std ;
- int main()
- {
- int a, b, sum = 0, t = 0, k = 0;
- cin >> a >> b ;
- while(a)
- {
- sum = sum + a;
- a = a + t;
- t = a%b;
- a = a / b;
- }
- cout << sum;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement