#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
long long x, y, ans;
while(cin >> x >> y){
ans = x;
while(x >= y){
ans = ans + x / y;
x = x % y + x / y;
}
cout << ans << endl;
}
return 0;
}
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
long long x, y, ans;
while(cin >> x >> y){
ans = x;
while(x >= y){
ans = ans + x / y;
x = x % y + x / y;
}
cout << ans << endl;
}
return 0;
}
No comments:
Post a Comment