mirror of
https://github.com/tiennm99/codeforces.git
synced 2026-06-09 14:11:38 +00:00
[Init] Solved solutions
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
int a, b, d = 0, c = 0;
|
||||
cin >> a >> b;
|
||||
do
|
||||
{
|
||||
while (a > 0)
|
||||
{
|
||||
c += a;
|
||||
d += a%b;
|
||||
a /= b;
|
||||
}
|
||||
a = d/b;
|
||||
d %= b;
|
||||
}
|
||||
while (a > 0);
|
||||
cout << c;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user