The h-index of an author is the largest h where he has at least h papers with citations not less than h.
Bobo has no papers and he is going to publish some subsequently.
If he works on a paper for x hours, the paper will get (a?x) citations, where a is a known constant.
It‘s clear that x should be a positive integer.
There is also a trick -- one can cite his own papers published earlier.
Given Bobo has n working hours, find the maximum h-index of him.
Bobo有n个小时时间用来写论文,每个小时的论文写作可以提升a的论文引用。新的论文可以引用自己之前写的论文。
要求输出最大可能的h-index(所有的论文中,有至少h篇的引用数不低于h)
首先需要先使每篇论文的引用数都尽可能大,通过思考我们不难得知,尽可能地多写论文能得到最大的收益
考虑极端的情况,假如只写一篇论文,那么它的引用数就是
在这种情况下,如何计算h-index的值呢?
由于论文引用数为等差数列,不难可以得到引用数大于h的论文数量为
于是就可以根据h的定义列出方程
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
ios::sync_with_stdio(false);
ll n, a;
while (cin >> n >> a)
{
cout << (n + a) / 2<<"\n";
}
return 0;
}
原文:https://www.cnblogs.com/iceyz/p/14649575.html