Advertisement
rengetsu

Codeforces_379A

Aug 7th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. //Codeforces Round 379A
  2. #include <iostream>
  3. using namespace std ;
  4. int main()
  5. {
  6.    int a, b, sum = 0, t = 0, k = 0;
  7.    cin >> a >> b ;
  8.    while(a)
  9.    {
  10.      sum = sum + a;
  11.      a = a + t;
  12.      t = a%b;
  13.      a = a / b;
  14.    }
  15.    cout << sum;
  16.    return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement