跳到正文

题解

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

huang_j约 1 分钟
原文
文章信息与版本

文章信息

发布
2025年1月21日
收录
2025年12月12日
更新
2026年11月12日
篇幅
约 1 分钟
获赞
1
题目
P11599

版本

  1. v1当前

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

C++
#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;
}
原文