当前位置:网站首页>【CF】 A. New Year Candles

【CF】 A. New Year Candles

2022-06-11 07:10:00 percation

Through the tunnel


The question and A. Vasya and Socks Very much alike , Almost the same idea .

A. Vasya and Socks


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 10;
int a,b;
int main(){
    
	cin >> a >> b;
	int ans = a + a / b;
	int u = a / b;
	int r = a % b;
	while(u != 0){
    
		if(r != 0){
    
			u += r;
		}
		r = u % b;
		u /= b;
		ans += u;
	}
	cout << ans << endl;
	
	return 0;
}
原网站

版权声明
本文为[percation]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/03/202203020522591492.html