Guest
Login
跳过导航链接

最短子序列
Time Limit:100MS  Memory Limit:32768K

Description:

给定长度为n的整数数列,A[0],A[1],A[2]….A[n-1]以及整数S,求出总和不小于S的连续子序列的长度的最小值。如果解不存在,则输出0。

Input:

输入数据有多组,每组数据第一行输入n,S, (10<n<10^5,S<10^8)第二行输入A[0],A[1],A[2]….A[n-1] ( 0<A[i]≤10000),处理到文件结束。所有输入数据都在int范围之内。

Output:

每组数据输出结果占一行。

Sample Input:

10 15
5 1 3 5 10 7 4 9 2 8

Sample Output:

2

Hint:

在样本输入中,A[3]+A[4]=5+10=15≥15,所以输出2
Status  Submit


Zhe Jiang University Of Technology Online Programming Space Beta1.3
Designed & Developped By Jin Qiwei
Refactored By cb@zjut.edu.cn , QQ Group: 723311416  All Copyright Reserved 2006-
821