H-index因素

Problem Description

Paper quality and quantity have long been used to measure a research‘s scientific productivity and scientific impact. Citation, which is the total times a paper has been cited, is a common means to judge importance of a paper. However, with
all these factors varying, a collegiate committee has problems when judging which research is doing better. For this reason, H-index is proposed and now widely used to combine the above factors and give accurate judgement. H-index is defined as:

A scientist has index h if h of [his] Np papers have at least h citations each, and the other(Np-h) papers have at most h citations each.

In other words, a scholar with an index of h has published h papers each of which has been cited by others at least h times. Note that H-index is always an integer. It‘s said that achiveing H-index of 18 means one is fully quality to be a professor, and H-index
of 45 or higher could mean membership in the United States Academy of Sciences.

You are to calculate the H-index for all the researchers in the list, base on the given information.

Input

There are multiple scenarios in the input, terminated by a single zero(0).

Each of the scenarios begin with an integer N(1<=N<=100), means that there are N papers. N lines follow, each contain a string(not exceeding 20 characters long), representing the author of the corresponding paper, without white spaces in-between. Though it
would be common for one paper written by several authors, there would be exactly one author of each of these papers. Finally, there are N lines of strings, containing ‘0‘s and ‘1‘s. If the j-th character in the i-th line is ‘1‘, it means the i-th paper cites
the j-th paper. A paper could never cite itself.

Output

For each scenario, output as many lines as the number of authors given. Each line contains the author‘s name and his H-index. The list should be sorted first by H-index in descending order, than by name in alphabetic order(Actually, ASCII
order. So ‘B‘ is prior to ‘a‘).

Output a blank line after each scenario.

Sample Input

4
Peter
Peter
Bob
Bob
0000
1000
1100
0100
0

Sample Output

Peter 2
Bob 0
//小明的H-index表示小明发表的论文中至少有H篇论文,这H篇论文每篇至少引用H次
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<cstring>
using namespace std;
struct input{
	string s;
	int b;
}a[110];
struct output{
	string s;
	int b;
}c[110];
bool cmp(input x,input y)
{
	if(x.s==y.s) return x.b>y.b;
	else return x.s<y.s;
}
bool cm(output x,output y)
{
	if(x.b==y.b) return x.s<y.s;
	else return x.b>y.b;
}
int main()
{
	//freopen("a.txt","r",stdin);
	int n;
	while(cin>>n&&n)
	{
		int k,i,len,j;
		for(i=0;i<n;i++)
		{
			cin>>a[i].s;
			c[i].b=a[i].b=0;
		}
		for(i=0;i<n;i++)
		{
			char m[110];
			scanf("%s",m);
			len=strlen(m);
			while(len>0)
			{
				if(m[len-1]-'0'==1&&i!=len-1) a[len-1].b++;  //计算每篇论文被引用的数量
			    len--;
			}
		}
		sort(a,a+n,cmp);
		for(k=0,i=0;i<n;i=j)
		{
			for(j=i;a[i].s==a[j].s;j++)
			if(a[j].b>c[k].b) c[k].b++;       //计算H-index(注意a[i].b是按从大到小排序的)
			c[k].s=a[i].s;
			k++;
		}
		sort(c,c+k,cm);
		for(i=0;i<k;i++) cout<<c[i].s<<' '<<c[i].b<<endl;
		printf("\n");
	}
	return 0;
}

版权声明:本文博客原创文章,博客,未经同意,不得转载。

时间: 2024-10-18 03:46:20

H-index因素的相关文章

H.264解码过程剖析-4

x264开源工程实现H.264的视频编码,但没有提供对应的解码器.ffmpeg开源多媒体编解码集合汇集了市面上几乎所有媒体格式的编解码的源代码.其中的H264.c就是一个能正常解码x264编码码流的独立的源文件,其使用步骤也与上述的编码或解码CODEC应用案例基本相同.这一节通过自顶向下的方式,讲述H264.c如何实现H.264视频解码过程. H264.c源文件有几千行,代码量庞大,很不便于浏览.分析和移植.同时该文件还依赖其他源文件,组织结构较复杂,实现平台由于不是基于Windows的VC++

FFmpeg的H.264解码器源代码简单分析:熵解码(Entropy Decoding)部分

本文分析FFmpeg的H.264解码器的熵解码(Entropy Decoding)部分的源代码.FFmpeg的H.264解码器调用decode_slice()函数完成了解码工作.这些解码工作可以大体上分为3个步骤:熵解码,宏块解码以及环路滤波.本文分析这3个步骤中的第1个步骤. 函数调用关系图 熵解码(Entropy Decoding)部分的源代码在整个H.264解码器中的位置如下图所示. 单击查看更清晰的图片 熵解码(Entropy Decoding)部分的源代码的调用关系如下图所示. 单击查

[LeetCode] 274. H-Index H指数

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 a

数据结构和算法 (二)数据结构基础、线性表、栈和队列、数组和字符串

Java面试宝典之数据结构基础 —— 线性表篇 一.数据结构概念 用我的理解,数据结构包含数据和结构,通俗一点就是将数据按照一定的结构组合起来,不同的组合方式会有不同的效率,使用不同的场景,如此而已.比 如我们最常用的数组,就是一种数据结构,有独特的承载数据的方式,按顺序排列,其特点就是你可以根据下标快速查找元素,但是因为在数组中插入和删除元素会 有其它元素较大幅度的便宜,所以会带来较多的消耗,所以因为这种特点,使得数组适合:查询比较频繁,增.删比较少的情况,这就是数据结构的概念.数据结构 包括

机器学习和深度学习资料合集

机器学习和深度学习资料合集 注:机器学习资料篇目一共500条,篇目二开始更新 希望转载的朋友,你可以不用联系我.但是一定要保留原文链接,因为这个项目还在继续也在不定期更新.希望看到文章的朋友能够学到更多.此外:某些资料在中国访问需要梯子. <Brief History of Machine Learning> 介绍:这是一篇介绍机器学习历史的文章,介绍很全面,从感知机.神经网络.决策树.SVM.Adaboost到随机森林.Deep Learning. <Deep Learning in

[转]机器学习和深度学习资料汇总【01】

本文转自:http://blog.csdn.net/sinat_34707539/article/details/52105681 <Brief History of Machine Learning> 介绍:这是一篇介绍机器学习历史的文章,介绍很全面,从感知机.神经网络.决策树.SVM.Adaboost到随机森林.Deep Learning. <Deep Learning in Neural Networks: An Overview> 介绍:这是瑞士人工智能实验室Jurgen

uva10282-字典

此题为小白书暴力求解法哈希表的训练参考 题目链接 http://acm.hust.edu.cn/vjudge/problem/24031 最近为了快速入门...所以挑了些简单的题目先做... 解题思路 最多会录入100000个单词对.可以设计一个简单的哈希函数,比如下标*单词这样的, 当然这样会造成较多冲突,如果是极限数据的话装填因子a达到了100... 如果用拉链法解决冲突的话,平均查找长度其查找成功大概是50左右,速度上还是可以凑合的. 填装因子a = 填入表中记录的个数 / 散列表的长度

leetcode -eleven:Container With Most Water

Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two lines, which together with x-axis forms a containe

回文数 第N个回文数

判断回文数还是不难,如果能转为字符串就更简单了. 如果是求第N个回文数呢. 12321是一个回文数,这里先考虑一半的情况. 回文数的个数其实是有规律的.如: 1位回文数: 9个 2位回文数: 9个 3位回文数: 90个 4位回文数: 90个 5位回文数: 900个 6位回文数: 900个 … 我们看到9.90.900,是不是很有规律,那是什么原因?很简单,我们把回文数拆开两半 [123321]来看.两半的变化一样的,那我们只算其中一半就行了.首位不能是0,所以左半最小为 100,最大为999,共

(转)让所有浏览器支持HTML5 video视频标签

转自http://www.zhangxinxu.com/wordpress/?p=661 一.前面的唠叨 我记得就是前几个月吧,有条消息说YouTube支持了HTML5视频嵌入标签video,好吧,我听说而已,因为我不是个擅长FQ的人,到底如何我也不得而知. 与主题不相关的HTML5方面的东西我就不多说了,对于video标签,获取大家都听说了,这个标签的功能如同现在HTML语言中的img标签,就现在,比如要链接并显示一张图片,可以这样子: <img data-src="http://ima