H-index因素
Problem Description
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
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
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;
}
版权声明:本文博客原创文章,博客,未经同意,不得转载。
H-index因素的更多相关文章
- HDU-6278-Jsut$h$-index(主席树)
链接: https://vjudge.net/problem/HDU-6278 题意: The h-index of an author is the largest h where he has a ...
- jQuery—一些常见方法(1)【filter(),not(),has(),next(),prev(),find(),eq(),index(),attr(),】
1.filter()和not()方法 filter()和not()是一对反方法,filter()是过滤. filter()方法是针对元素自身.(跟has()方法有区别) <script type ...
- FFmpeg的H.264解码器源代码简单分析:熵解码(Entropy Decoding)部分
===================================================== H.264源代码分析文章列表: [编码 - x264] x264源代码简单分析:概述 x26 ...
- [LeetCode] 274. H-Index H指数
Given an array of citations (each citation is a non-negative integer) of a researcher, write a funct ...
- 【机器学习Machine Learning】资料大全
昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...
- 机器学习(Machine Learning)&深度学习(Deep Learning)资料【转】
转自:机器学习(Machine Learning)&深度学习(Deep Learning)资料 <Brief History of Machine Learning> 介绍:这是一 ...
- 记一次uboot升级过程的两个坑
背景 之前做过一次uboot的升级,当时留下了一些记录,本文摘录其中比较有意思的两个问题. 启动失败问题 问题简述 uboot代码中用到了一个库,考虑到库本身跟uboot版本没什么关系,就直接把旧的库 ...
- jquery基本操作笔记
来源于:http://www.cnblogs.com/webcome/p/5484005.html jq和js 可以共存,不能混用: 1 2 3 4 5 6 $('.box').css('backgr ...
- layer——源码学习
一.根据源码的学习 发现创建弹窗:使用了一些div来组成 zindex 和 index 是自动生成. zindex 表示生成的层次关系 index 用来表示各个层的id 默认class名 h = [& ...
- 多功能弹窗控件layer
开发网站的时候,如何合理运用好各种插件对开发的帮助是很大的. 免去了我们调试各种交互效果, 比如常用的弹窗.气泡.提示.加载.焦点.标签.导航.折叠等等 这里会推荐几个常用的js插件,丰富多样简单易移 ...
随机推荐
- UNIX环境高级编程——TCP/IP网络编程
常用网络信息检索函数 gethostname() getppername() getsockname() gethostbyname() gethostbyaddr() getprotobyname( ...
- xml学习(1)xml的几种文件格式
1.先简单介绍一下XML,xml 是基于文本的标记性行语言,类似于html,可以方便存储数据 2,XML文件的几种格式: 格式1:查看一个 XML 的 CD 目录 <?xml version=& ...
- linux+nginx+mysql+php高性能服务器搭建
1.安装基础包 yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freet ...
- 虚拟主机的配置、DNS重定向网站
虚拟主机的配置:我用的是localhost本地测试站点+Apache环境 第一步:找到Apache安装目录下的httpd-vhosts.conf文件,然后启用这个文件,如何启用这个文件呢?当然是在ht ...
- 在程序中,你敢怎样使用“goto”语句!
用goto是一个个人爱好的问题.“我”的意见是,十个goto中有九个可以用相应的结构化结构来替换.在那些简单情形下,你可以完全替换掉goto,在复杂的情况下,十个中也有九个可以不用:你可以把部分代码写 ...
- EFM32在使用IAR开发环境配置ICf文件以及指定程序存储地址空间
EFM32在IAR开发环境下指定代码,数据的存储空间 为了便于后续的项目升级,管理,需要对代码,数据的存储空间加以设定,也在网上找下相关的资料,笔者水平有限, 如下内容不一定完全正确,如有错误之后,还 ...
- 基于visual Studio2013解决面试题之1007鸡蛋和篮子
题目
- OpenSSL---堆栈
堆栈是一种先进后出的数据结构.是一种只允许在其一端进行插入或者删除的线性表.允许插入或删除操作的一端为栈顶,另一端称为栈底.对堆栈的插入和删除操作称为入栈和出栈. 1.1 概述 OpenSSL ...
- net core VS goang web
asp.net core VS goang web[修正篇] 先前写过一篇文章:http://www.cnblogs.com/gengzhe/p/5557789.html,也是asp.net core ...
- jssdk微信图片上传功能
/*wx.config({ debug: false, appId: data.appid, timestamp: data.timestamp, nonceStr: data.nonceStr, s ...