博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NEU 1683: H-Index
阅读量:4869 次
发布时间:2019-06-11

本文共 2303 字,大约阅读时间需要 7 分钟。

题目描述

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
#include
#include
#include
#include
#include
#include
#include
#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
,greater
>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<
<

 

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

你可能感兴趣的文章
sgu 103. Traffic Lights
查看>>
poj 3621 Sightseeing Cows
查看>>
hdu 3666 THE MATRIX PROBLEM
查看>>
TopCoder SRM 176 Deranged
查看>>
java 内存模型
查看>>
MetalKit_1
查看>>
C# 利用BarcodeLib.dll生成条形码(一维,zxing,QrCodeNet/dll二维码)
查看>>
二进制求最大公约数&&输出二进制
查看>>
设计模式之建造者模式(Builder)
查看>>
shell、cmd、dos和脚本语言
查看>>
javafx实现手机版QQ登录界面
查看>>
XML到底是什么
查看>>
35 个 Java 代码性能优化总结
查看>>
mac平台安装配置TomCat
查看>>
组播原理
查看>>
tomcat安装
查看>>
关于互斥锁和条件变量
查看>>
HDU1846(巴什博奕)
查看>>
改变checkbox和radio的默认样式
查看>>
微机原理之 80x86微处理器
查看>>