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;
}

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

H-index因素的更多相关文章

  1. 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 ...

  2. jQuery—一些常见方法(1)【filter(),not(),has(),next(),prev(),find(),eq(),index(),attr(),】

    1.filter()和not()方法 filter()和not()是一对反方法,filter()是过滤. filter()方法是针对元素自身.(跟has()方法有区别) <script type ...

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

    ===================================================== H.264源代码分析文章列表: [编码 - x264] x264源代码简单分析:概述 x26 ...

  4. [LeetCode] 274. H-Index H指数

    Given an array of citations (each citation is a non-negative integer) of a researcher, write a funct ...

  5. 【机器学习Machine Learning】资料大全

    昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...

  6. 机器学习(Machine Learning)&深度学习(Deep Learning)资料【转】

    转自:机器学习(Machine Learning)&深度学习(Deep Learning)资料 <Brief History of Machine Learning> 介绍:这是一 ...

  7. 记一次uboot升级过程的两个坑

    背景 之前做过一次uboot的升级,当时留下了一些记录,本文摘录其中比较有意思的两个问题. 启动失败问题 问题简述 uboot代码中用到了一个库,考虑到库本身跟uboot版本没什么关系,就直接把旧的库 ...

  8. jquery基本操作笔记

    来源于:http://www.cnblogs.com/webcome/p/5484005.html jq和js 可以共存,不能混用: 1 2 3 4 5 6 $('.box').css('backgr ...

  9. layer——源码学习

    一.根据源码的学习 发现创建弹窗:使用了一些div来组成 zindex 和 index 是自动生成. zindex 表示生成的层次关系 index 用来表示各个层的id 默认class名 h = [& ...

  10. 多功能弹窗控件layer

    开发网站的时候,如何合理运用好各种插件对开发的帮助是很大的. 免去了我们调试各种交互效果, 比如常用的弹窗.气泡.提示.加载.焦点.标签.导航.折叠等等 这里会推荐几个常用的js插件,丰富多样简单易移 ...

随机推荐

  1. 我的CSS架构

    写在前面 都是自己看别人的架构,自己积累下来的一些东西,这里只是阐述自己的一些观念.借此希望同行交流交流下看法,共勉. 不同架构的CSS 业务流程不同,团队配员不同.会有各种各样的CSS架构. 有的会 ...

  2. Java I/O流-PipedInputStream、PipedOutputStream

    一.整体代码图 PipedStreamDemo.java import java.io.*; class PipedStreamDemo { public static void main(Strin ...

  3. RTSP调试代码

    #ifdef _WIN32_WCE #include "stdafx.h" #endif #ifndef _WIN32_WCE #define WIN32_LEAN_AND_MEA ...

  4. Core 中文文档

    ASP.NET Core 中文文档 第二章 指南(1)用 Visual Studio Code 在 macOS 上创建首个 ASP.NET Core 应用程序   原文:Your First ASP. ...

  5. TIA Portal V12不能添加新的CPU

    4核AMD 740,10G内存,Win7 X64,打开TIA Portal V12,依旧慢如牛,鼠标指针转啊转,TIA窗口写着 无响应... 真没志气,STM32要是玩转了,坚决不用这老牛. 上图为正 ...

  6. N使用exus2打造企业maven仓库(三)

    假设项目中,我没有使用maven,我应该做出选择,或为项目.或者用它来推动这个项目从maven.有人会问,为什么maven?无需maven我们没有很好的操作. 这里,只说两件事情我最欣赏:第一点是管理 ...

  7. iOS开发- 查询项目代码行数

    ...事实上, 这功能也没什么用. 就是查询一个项目总的代码行数. 玩玩倒是能够. 方法: 在终端以下依次输入: cd 项目文件 find . "(" -name "*. ...

  8. 实现文件下载的java代码

    实现文件下载的java代码 //这是实现下载类(servlet),详细思路代码例如以下://也可连接数据库package com.message; import javax.servlet.*;imp ...

  9. wince平台下使用log4net记录日志

    前面我写过一篇文章是来介绍windows平台下开发软件使用log4net来记录日志的,详情请参考:用一个简单的示例说明日志记录组件log4net的使用. 我们在wince平台下开发程序也一样需要日志文 ...

  10. 在命令行获取标准输入序列的反互序列,pep序列和长度信息

    近期对序列文件处理的比較多,时常要看一些核酸序列的反向互补序列,长度.可能的翻译序列. 曾经我常用seqBuider 来查看.假设能在命令行直接查看.想必是极好的. 这是一个perl脚本.只是我把它的 ...