题解:P11599 『Fwb』神话の传播

· · 题解

数据比较小,模拟一下即可。

#include <bits/stdc++.h>
#define ll long long
#define D(x) cout << #x << ": " << x << ' '
#define DE(x) cout << #x << ": " << x << '\n'
using namespace std;
ll n, x, k;
// 体力 追了多少 过了几天
ll tl, sum, ans;
int main()
{
    ios :: sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> n >> x >> k;
    tl = k; // 注意一开始体力就有 k
    while (sum < n)
    {
        if (tl == 0)
            tl = k, ans++;
        else
            sum += x, ans++, tl--;
//      cout << sum << ' ' << tl << '\n';
    }
    cout << ans << '\n';
    return 0;
}