题目描述
Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.
According to the definition of h-index on Wikipedia: "A scientist has index h if h of his/her N papers have at least h citations each, and the other N − h papers have no more than h citations each."
For example, given citations = [3, 0, 6, 1, 5], which means the researcher has 5 papers in total and each of them had received 3, 0, 6, 1, 5 citations respectively. Since the researcher has 3 papers with at least 3 citations each and the remaining two with no more than 3 citations each, his h-index is 3.
Note: If there are several possible values for h, the maximum one is taken as the h-index.
输入
First line is a non-negative integer T(0 < T <= 10) which indicates there are T testcases.
Then there is a non-negative integer n(0 < n <= 10000) which indicates the length of the citations.After that follows n non-negative integers arr[i] (0 <= arr[i] <= 3 * n)输出
Output the h-index
样例输入
153 0 6 1 5
样例输出
3 一名科研人员的h指数是指他至多有h篇论文分别被引用了至少h次。 样例 输入 n篇论文被引用的次数。输出这个研究人员的h指数。
/* ***********************************************Author :guanjunCreated Time :2016/3/5 13:17:38File Name :neu1683.cpp************************************************ */#include#include #include #include #include #include #include #include #include