Title-Description

所属分类:人工智能/神经网络/深度学习
开发工具:Dev C++
文件大小:1KB
下载次数:1
上传日期:2016-09-07 17:39:22
上 传 者YuriF
说明:  题目描述 传说中有一种蜜汁序列特别甜,所以爱吃甜的强渣学长特别喜欢这种序列。。。 蜜汁序列的定义如下:对于一个长度为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 Description 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 (1365, 2016-09-05)

近期下载者

相关文件


收藏者