import java.util.*;
public class test1 {
public static void main(String[] args)
{
int num=0;
test1 t1 = new test1();
int n,t,c;
Scanner s =new Scanner(System.in);
n = s.nextInt();
t = s.nextInt();
c = s.nextInt();
int data[] = new int[n];
for(int i=0;i<n;i++)
{
data[i] = s.nextInt();
}
num =t1.find(n,t,c,data);
System.out.println(num);
}
public int find(int n,int t,int c,int data[])
{
// int data[] = {1,2,3,4};
int num=0;
for(int i=0;i<n-c+1;i++)
{
int temp =0;
for(int j=i;j<i+c;j++)
temp = temp+data[j];
if(temp < t)
{
num++;
}
}
return num;
}
}
百度编程题——罪犯转移
最新推荐文章于 2023-08-17 21:07:49 发布