Codeforces 379A New Year Candles(模拟)

题目链接:Codeforces 379A New Year Candles

模拟,简单题。

#include <iostream>

using namespace std;

int a,b;

int main()
{
    while(cin >> a >> b)
    {
        int _max,remain;
        _max = remain = a;
        while(remain >= b)
        {
            _max += remain / b;
            remain = remain % b + remain / b;
        }
        cout << _max << endl;
    }
    return 0;
}


你可能感兴趣的:(Codeforces 379A New Year Candles(模拟))