题目描述

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

样例输入

1
5
3 0 6 1 5

样例输出

3

一名科研人员的h指数是指他至多有h篇论文分别被引用了至少h次。样例 输入 n篇论文被引用的次数。输出这个研究人员的h指数。
/* ***********************************************
Author        :guanjun
Created Time  :2016/3/5 13:17:38
File Name     :neu1683.cpp
************************************************ */
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <iomanip>
#include <list>
#include <deque>
#include <stack>
#define ull unsigned long long
#define ll long long
#define mod 90001
#define INF 0x3f3f3f3f
#define maxn 10010
#define cle(a) memset(a,0,sizeof(a))
const ull inf = 1LL << 61;
const double eps=1e-5;
using namespace std;
priority_queue<int,vector<int>,greater<int> >pq;
struct Node{int x,y;
};
struct cmp{bool operator()(Node a,Node b){if(a.x==b.x) return a.y> b.y;return a.x>b.x;}
};bool cmp(int a,int b){return a>b;
}
int a[maxn];
int main()
{#ifndef ONLINE_JUDGE//freopen("in.txt","r",stdin);#endif//freopen("out.txt","w",stdout);int t,n;cin>>t;while(t--){scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%d",&a[i]);}sort(a+1,a+1+n,cmp);int ans=-INF;for(int i=1;i<=n;i++){if(i>a[i]){ans=i-1;break;}}cout<<ans<<endl;}return 0;
}

转载于:https://www.cnblogs.com/pk28/p/5305532.html

NEU 1683: H-Index相关推荐

  1. Just $h$-index HDU - 6278(主席树找区间大于等于k的个数)

    The hh-index of an author is the largest hh where he has at least hh papers with citations not less ...

  2. HDU - 6278 Just $h$-index主席树+二分

    HDU - 6278 Just hhh-index [题目描述] [题目分析] 题目要求在区间[l,r][l,r][l,r]内大于h的数不少于h个,对于这种最大化问题,我们应该想到二分. 最小情况显然 ...

  3. H 指数 (citations[index] > h 才能符合条件)

    原题链接:https://leetcode-cn.com/problems/h-index/ h概念: h 代表"高引用次数"(high citations),一名科研人员的 h ...

  4. elasticsearch使用脚本 滚动关闭索引,更新index setting

    一 问题 在旧的索引中更新mapping时,新增了分词器(分词器已经在模板中添加),但是在更新mapping时报错: 查看elasticsearch官网,发现不允许在已经存在的索引中动态更新分词器,只 ...

  5. H指数问题(USACO)

    H指数 是什么 h指数(也叫h-index)是一个混合量化指标,最初是由美国加利福尼亚大学圣地亚哥分校的物理学家乔治·赫希(Jorge Hirsch)在2005年的时候提出来的,其目的是量化科研人员作 ...

  6. H.264解码过程剖析-4

    x264开源工程实现H.264的视频编码,但没有提供对应的解码器.ffmpeg开源多媒体编解码集合汇集了市面上几乎所有媒体格式的编解码的源代码.其中的H264.c就是一个能正常解码x264编码码流的独 ...

  7. ddd install strclass.h error: friend declaration of ‘string common_prefix

    ddd install strclass.h error: friend declaration of 'string common_prefix ddd version as following: ...

  8. “横平竖直”进行连线+将相邻框进行合并

    一.横平竖直"进行连线 解法1.将一些坐标点按照x相等,y相等连起来 解法1.根据 x或y总有一个相等的,用np.sum来找出和为1的点,然后在连起来,存在重复连线的问题. import n ...

  9. 机器视觉开源处理库汇总

    从cvchina搞到的机器视觉开源处理库汇总,转来了,很给力,还在不断更新... 通用库/General Library OpenCV 无需多言. RAVL Recognition And Visio ...

  10. ML CV DM PP

    CV会议+领先研究室+专家+代码网址 本文基于http://www.sciencenet.cn/m/Print.aspx?id=224651的结果,增加了自己搜索和国内一些信息. 作机器视觉和图像处理 ...

最新文章

  1. 02-NLP-01-python正则表达式
  2. 故事营销:一个具有争议的成功营销案例
  3. 不同存储区域的数组分析
  4. SWFTools pdf2swf 参数详解
  5. 2019 ACM-icpc西安邀请赛总结(无题解)
  6. 网易应用创新开发者大赛成功在杭举办,十强队伍现场比拼
  7. 使用 做签名的post_ASP.NET WebApi 基于分布式Session方式实现Token签名认证
  8. 11月深度学习班第5课图像物体检测:rcnn/fast-rcnn/faster-rcnn
  9. golang reflect
  10. hs控什么意思_凡尔赛文学 到底是什么?
  11. 微型计算机发展方向网络化,第二章 会计电算化工作环境
  12. Matlab协方差矩阵的计算原理
  13. Windows无法安装到磁盘磁盘具有MBR分区表的解决
  14. 世界头号黑客“米特尼克”对生活的见解自述
  15. 左手鼠标指针_使您的鼠标指针左手友好
  16. Python与企业微信-2
  17. 互质 整除 同余
  18. Python基础_08( 变量的基本使用)
  19. 知乎高赞:什么能力很重要,但大多数人都没有?
  20. [GDKOI2016]不稳定的传送门

热门文章

  1. Android 两种方式实现类似水波扩散效果
  2. ConstraintLayout约束控件详解
  3. 验证码计时 -- UIButton setTitle 闪烁问题解决方案
  4. 04.SQLServer性能优化之---读写分离数据同步
  5. Mysql三种备份,mysqdump,xtrabackup工具,基于lvm-snapshot快照备份等。
  6. 【转】C/C++中宏使用总结
  7. CLion开发,运行报错后问题排查
  8. android从子页面跳转回主页面注意
  9. android 数组赋值字符串_给字符数组赋值的方法
  10. hutool 读取扩展名文件_如何快速的搜索文件,Everything使用技巧