/*很简单的一题,求连续的m位,求总和最多的值,循环找一下,就出来了*/
#include<stdio.h>
int d[];
int main(int argc, char* argv[])
{
int t,i,j;
int n,m,sum,max;
while(scanf("%d",&t)!=EOF)
{
while(t--)
{
scanf("%d%d",&n,&m);
for(i=;i<n;i++)
scanf("%d",&d[i]); max=;
for(i=;i<n;i++)
{
sum=;
for(j=i;j<i+m;j++)
sum+=d[j%n];
if(max<sum)
max=sum;
}
printf("%d\n",max);
}
}
return ;
}
相关文章
- 12-20java.lang.ClassCastException: sun.jdbc.odbc.JdbcOdbcStatement cannot be cast to java.beans.Statement
- 12-20ZOJ 3876 JAVA
- 12-20java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.
(L - 12-20java.lang.NoSuchMethodError: org.springframework.beans.factory.config.ConfigurableBeanFactory.getSingletonMutex()Ljava/lang/Object
- 12-20java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.
(Ljava/lang/Class;)V - 12-20?--Porg.springframework.beans.MethodInvocationException: Property 'username' threw exception; nested exception is java.lang.NullPointerException
- 12-20ZOJ 1442 Dinner Is Ready 容斥原理 + java大数
- 12-20java配置xml报cvc-complex-type.2.3: 元素 'beans' 必须不含字符 [子级], 因为该类型的内容类型为“仅元素”
- 12-20zoj 3714 Java Beans
- 12-20org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: c