文件名称:Title-Description

  • 所属分类:
  • 其他小程序
  • 资源属性:
  • [C/C++] [源码]
  • 上传时间:
  • 2016-09-07
  • 文件大小:
  • 1kb
  • 下载次数:
  • 0次
  • 提 供 者:
  • 相关连接:
  • 下载说明:
  • 别用迅雷下载,失败请重下,重下不扣分!

介绍说明--下载内容均来自于网络,请自行研究使用

题目描述



传说中有一种蜜汁序列特别甜,所以爱吃甜的强渣学长特别喜欢这种序列。。。



蜜汁序列的定义如下:对于一个长度为n的序列a1,...,an,如果这个序列的n个前缀和全部非负,即若a1> 0,a1+a2> 0,...,a1+a2+...+an> 0,则称a序列是蜜汁序列。。。



显然一些蜜汁序列可以分成更多的蜜汁序列,例如1 2这个蜜汁序列可以分成1和2两个蜜汁序列,现在有一个长度为n的蜜汁序列,要求你把他分成若干连续的段,使得每段都是一个蜜汁序列,问最多可以分成多少段?



输入



多组用例,每组用例首先输入一个整数n表示给出的蜜汁序列长度,之后输入n个整数a1,a2,...,an表示该序列的n个元素,以文件尾结束输入



输出



对于每组用例,输出一个整数占一行,表示该序列最多可以分成多少个蜜汁序列



数据范围



用例不超过10组,1< n< 10^6,-10^4< ai< 10^4(i 1,2,...,n)



样例输入



1



1



3



1 2 3





样例输出



1



3-Title Descr iption

There is a legend of the honey series especially sweet, so sweet strong slag seniors love this series...

The definition of honey sequences are as follows: for a length sequence of A1, N, an,... If the sequence of the N prefix and all non negative, i.e. a1> 0, a1+a2> 0,..., a1+a2+...+an> 0, said a sequence is a sequence of honey...

Obviously some honey honey sequence can be divided into more sequences, such as the 12 series of honey can be divided into 1 and 2 two honey series, now has a length of honey sequence n, ask you to put him into several consecutive segments, each segment is a sequence of honey, ask most can be divided into many segments?

input

Many groups of cases, each case first enter an integer n indicating honey sequence length are given, then input n integers A1, A2,..., an said that the sequence of n elements, the tail end of the input file

output

For each case, output one integer per line, said the most sequence can be divided into how
(系统自动生成,下载前可以参看下载内容)

下载文件列表





铚滄眮搴忓垪.cpp

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度更多...
  • 请直接用浏览器下载本站内容,不要使用迅雷之类的下载软件,用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.

相关评论

暂无评论内容.

发表评论

*主  题:
*内  容:
*验 证 码:

源码中国 www.ymcn.org