P15836

WA

#include<bits/stdc++.h>
using namespace std;
int n,m,ans,sum,a[200005];
signed main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=n;i++)cin>>a[i];
	for(int i=1,j=1;i<=n;i++){
		while(j<=n&&sum<=m){
			sum+=a[j];
			j++;		
		}
		ans=max(ans,j-i);
		sum-=a[i];
	}
	cout<<ans<<endl;
	return 0;
}

哪一题?把题面发出来看一下