思路
不妨假设有 名测试员。
则每个测试员都会在公共聊天频道发送 个单词。
且每个测试员都会对其他测试员发送 个单词。
所以共发送了 个单词。
我们要求满足 的 的最小值。
所以我们只需要二分答案 就行了。
左边界:, 所以至少都要1个测试员
右边界:,当 时 为 ,所以右边界为
代码
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
ull n, a, b;
int main() {
cin >> n >> a >> b;
ull l = 1, r = n + 1, m, ans;
while (l <= r) {
m = l + (r - l) / 2;
if (m * a + m * (m - 1) * b >= n) {
ans = m;
r = m - 1;
} else {
l = m + 1;
}
}
cout << ans;
return 0;
}