点击打开链接

Easy h-index

Time Limit: 2000/1000 MS (Java/Others)    

Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 761    Accepted Submission(s): 213

Problem Description

比赛题目:
http://acm.hdu.edu.cn/downloads/2018ccpc_hn.pdf

The h-index of an author is the largest h where he has at least h papers with citations not less than h.
Bobo has published many papers.
Given a0,a1,a2,…,an which means Bobo has published ai papers with citations exactly i, find the h-index of Bobo.

Input

The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains an integer n.
The second line contains (n+1) integers a0,a1,…,an.

Output

For each test case, print an integer which denotes the result.
## Constraint
* 1≤n≤2⋅105
* 0≤ai≤109
* The sum of n does not exceed 250,000.

Sample Input

1

1 2

2

1 2 3

3

0 0 0 0

Sample Output

1

2

0

分析:

作者的h指数是一个最大的h,h代表至少有h篇文章被引用h次

a[i]表示被引用i次的文章个数,i从0开始,求作者的h指数

#include <cstdio>
const int N = 2e5+10;
int a[N];
int main()
{int n;while (scanf("%d", &n) == 1) {for (int i = 0; i <= n; ++ i)scanf("%d", a + i);//预处理前缀和for(int i=n-1;i>=0;i--)a[i]+=a[i+1];for(int i=n;i>=0;i--){if(a[i]>=i){printf("%d\n",i);break;}}}
}

HDU1001 Easy h-index相关推荐

  1. error: Please reinstall the libcurl distribution - easy.h should be in curl-dir/include/curl/

    执行php-5.3.10 --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --e ...

  2. configure: error: Please reinstall the libcurl distribution - easy.h should be ……

    configure: error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/ 其实就 ...

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

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

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

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

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

  6. php 编译安装 png.h,PHP编译安装时常见错误解决办法【大全】

    This article is post on https://coderwall.com/p/ggmpfa configure: error: xslt-config not found. Plea ...

  7. linux 安装libcurl4-gnutls-dev,curl / curl.h,libcurl,libcurl4-openssl-dev,libcurl4-nss-dev库之间的区别?...

    我有以下curl标题,我仍然可以安装上面提到的libcurl4包 – kafka@Metamorphosis:~$ll /usr/include/curl/ total 200 drwxr-xr-x ...

  8. linux安装easy php,Linux php安装

    php版本:php-5.4.3 安装前.先安装些软件和库文件 yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel libj ...

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

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

最新文章

  1. Java从基础进阶到高手
  2. cygwin 在 windows 下的安装
  3. EXCEL_CLASS
  4. Zabbix最佳实践一:Zabbix4.0.2的安装与配置
  5. 算法设计与分析——回溯法——符号三角形问题
  6. STM32CubeIDE教程-现场表达式切换数字进制表示
  7. docker导入与导出容器
  8. ga 工具箱 matlab,初识遗传算法之MatlabGA工具箱
  9. 马云盖茨入选最伟大25名抗疫领袖;周鸿祎卸任360金服;Node.js 14发布 | 极客头条...
  10. DES加密/解密类。
  11. Costomize Print Output
  12. UVA 679 小球掉落 思维 + 数据结构
  13. java有道翻译_java实现有道翻译爬虫
  14. ROS学习(一)Ros 中使用kinect
  15. 运动型蓝牙耳机什么牌子好、最适合运动的耳机
  16. OpenCV之VideoCapture的使用——打开网络摄像头/图像序列
  17. Linux 图片转换命令 convert
  18. 一步一步做项目(3)创建Web项目
  19. 世界第二例艾滋病患者被治愈,“柏林病人”不再孤单
  20. 【Unity3D插件】uMOBA插件分享《Moba类游戏框架插件》

热门文章

  1. 产品经理 - 学习书籍
  2. Linux 内核配置机制(make menuconfig、Kconfig、makefile)讲解
  3. SQLite介绍、学习笔记、性能测试
  4. 解决KMP看高清电影背景声大说话声小问题
  5. java外部类调用内部类_java中的外部类和内部类 | 学步园
  6. dw网页设计期末设计一个网页_制作网站与设计网页可以用什么软件?
  7. js中当等于最小值是让代码不执行_JavaScript中最最基础的知识点
  8. vue中进度条写法_vue组件实现进度条效果
  9. python发送文件_Python实现基于HTTP文件传输实例
  10. nio java 内核拷贝_大文件拷贝,试试NIO的内存映射