2016河南省第九届ACM程序设计竞赛[正式赛四]

-0:12:10
  • Overview
  • Problem
  • Status
  • Rank
Current Time: 2016-04-13 13:47:49 Contest Type: Private
Start Time: 2016-04-13 09:00:00 Contest Status: Running
End Time: 2016-04-13 14:00:00 Manager: zhongshijun
ID
Title
26 / 49 Problem A A
  0 / 11 Problem B B
  3 / 52 Problem C C
  0 / 2 Problem D D
23 / 158 Problem E E
  0 / 3 Problem F F
  0 / 4 Problem G G
22 / 60 Problem H H
  25 / 27 Problem I I

A B C D E F G H I
E - E

Crawling in process... Crawling failed Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu

Submit Status

Description

Last week, n students participated in the annual programming contest of Marjar University. Students are labeled from 1 to n. They came to the competition area one by one, one after another in the increasing order of their label. Each of them went in, and before sitting down at his desk, was greeted by his/her friends who were present in the room by shaking hands.

For each student, you are given the number of students who he/she shook hands with when he/she came in the area. For each student, you need to find the maximum number of friends he/she could possibly have. For the sake of simplicity, you just need to print the maximum value of the n numbers described in the previous line.

Input

There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case:

The first line contains an integer n (1 ≤ n ≤ 100000) -- the number of students. The next line contains n integers a1, a2, ..., an (0 ≤ ai < i), where ai is the number of students who the i-th student shook hands with when he/she came in the area.

Output

For each test case, output an integer denoting the answer.

Sample Input

2
3
0 1 1
5
0 0 1 1 1

Sample Output

2
3




#include<stdio.h>
int a[109000];
int main()
{int t,i,n;scanf("%d",&t);while(t--){scanf("%d",&n);int p=0;for(i=1; i<=n; i++){scanf("%d",&a[i]);if(a[i]==0){p++;}}if(p==n){printf("0\n");}else{int sum=0;i=2;while(i<=n){if(a[i]!=0){sum=a[i];for(int j=i+1; j<=n; j++){if(a[j]!=0){if(sum<a[j]){sum=a[j];}else{sum++;}}}printf("%d\n",sum);break;}else{i++;}}}}
}

2016河南省第九届ACM程序设计竞赛[正式赛四]相关推荐

  1. “师创杯”山东理工大学第九届ACM程序设计竞赛 正式赛 F.校赛~校赛~【思维+规律题】

    校赛~校赛~ Time Limit: 1000MS  Memory Limit: 65536KB Submit  Statistic Problem Description SDUT 的校赛是从 20 ...

  2. 2016河南省第九届ACM程序设计竞赛【正式赛真题】

    A题:表达式求值 时间限制: 1000 ms  |  内存限制: 65535 KB 描述 假设表达式定义为:1. 一个十进制的正整数 X 是一个表达式.2. 如果 X 和 Y 是 表达式,则 X+Y, ...

  3. “师创杯”山东理工大学第九届ACM程序设计竞赛 正式赛 I.皮卡丘的梦想2【树状数组】水题

    皮卡丘的梦想2 Time Limit: 1000MS Memory Limit: 65536KB Submit Statistic Problem Description 一天,一只住在 501 的皮 ...

  4. 次短路问题(陕西师范大学第九届ACM程序设计竞赛-F 新冠病毒要回家)

    求到顶点v的次短路时,有两种情况,要么是到其他某个顶点u的最短路再加上u->v的边,要么是到某个顶点u的次短路再加上u->v的边. 一般我们用Dijkstra求得最短路(无负权边),由此我 ...

  5. 【超好懂的比赛题解】“山大地纬杯”第十二届山东省ICPC大学生程序设计竞赛(正式赛)

    title : "山大地纬杯"第十二届山东省ICPC大学生程序设计竞赛(正式赛) date : 2022-5-30 tags : ACM,题解,练习记录 author : Linn ...

  6. 青岛农业大学第九届ACM程序设计竞赛

    Problem A 喆神装书 https://ac.nowcoder.com/acm/contest/906/A 题意:是否能够把所有的书都放在两个背包里. 题解:贪心 C++版本一 /* *@Aut ...

  7. 哈尔滨工业大学(威海)第九届ACM程序设计竞赛

    Problem A All Palindrome https://ac.nowcoder.com/acm/contest/624/A 题解:这个字符串只能是所有字符相同的 /* *@Author: S ...

  8. 河南省第十一届ACM程序设计竞赛 修路

    Problem C: 修路 Time Limit: 3 Sec  Memory Limit: 128 MB Submit: 63  Solved: 22 [Submit][Status][Web Bo ...

  9. “师创杯”山东理工大学第九届ACM程序设计竞赛 热身赛 E.上色的纱雾【二分+贪心】

    上色的纱雾 Time Limit: 1000MS  Memory Limit: 65536KB Submit  Statistic Problem Description 纱雾画画功力首屈一指,现在她 ...

  10. 师创杯”山东理工大学第九届ACM程序设计竞赛(网络同步赛)--I皮卡丘的梦想2

    作为水题王者前去水了一波山东理工大学的校赛,这道题一个小细节坑了我2个小时,思路其实很简单,就是线段树单点更新的模板,用一个60的数组标记,如果这个区间内有I种类的化石,那么就是1,否则为0,加入新化 ...

最新文章

  1. Linux bash中I/O重定向及管道
  2. 简化PHP开发的10个工具
  3. 加入收藏 lsk的BLOG
  4. 数据结构---平衡二叉树
  5. 候选JEP:记录和密封类型
  6. TFS2010 删除工作区(同时删除工作区中所有的目录映射)
  7. 编译程序和解释程序有哪些区别?
  8. python操作excel命令_python操作Excel读写(使用xlrd和xlrt)[转帖]
  9. HashSet、LinkedHashSet、TreeSet 简明解释
  10. SkyEye图形化界面使用技巧篇(一)
  11. ckEditor使用JS代码调用的方法
  12. 获取当前日期是本年的第几周java与mysql获取值不一致
  13. Flutter代码锦囊---切换时页面保持状态
  14. 团队项目:即时聊天软件 需求分析、用例、UI原型
  15. STM8S003F3和N76E003功能引脚对比
  16. 台式机插上耳机,声音仍然外放问题解决
  17. 2022-6-25 12点 程序爱生活 恒指选择继续向上震荡,而且等来了推动前期上涨原因的一个消息:港股的ETF通过港股通可以交易
  18. 结构体对齐(字节对齐)规则及大小计算
  19. 电脑软件连接ABB机器人控制柜
  20. selenium 页面加载超时处理

热门文章

  1. Odoo----的消息系统 - Mail 模块 - Discuss 应用
  2. 中国智慧VS西方智慧-看中国IT风云
  3. 使用 Litho 改进 News Feed 上的 Android 视频表现
  4. C语言的内存问题总结
  5. debian9上的openwrt创建自己的IPK软件
  6. 聚合物/硅胶色谱填粒径1.7μm到50μm
  7. win linux批处理删除指定N天前文件夹的文件
  8. [论文总结] 深度学习在农业领域应用论文笔记8
  9. u盘芯片 测试软件,U盘芯片检测工具(Chip Genius)
  10. Foxit PDF SDK ActiveX 5.9.4