题目类型忘记了。
#include "stdio.h"
int sum[100005];
int main()
{
    
int m,n,s;
    
int i;
    
int left,right,min;
    
while(scanf("%d",&m)!=EOF)
    
{
        
while(m>0)
        
{
            scanf(
"%d%d",&n,&s);
            sum[
0]=0;
            
for(i=1;i<=n;i++)
            
{
                scanf(
"%d",&sum[i]);
                sum[i]
+=sum[i-1];
            }

            
if(sum[n]<s)printf("0\n");
            
else
            
{
                left
=right=0;
                min
=n;
                
while(right<=n)
                
{
                    
if(sum[right]-sum[left]<s)right++;
                    
else
                    
{
                        
if(right-left<min)min=right-left;
                        
if(sum[right]-sum[left]==s)right++;
                        
else left++;
                    }

                }

                printf(
"%d\n",min);
            }

            m
--;
        }

    }

    
return 0;
}