标签:blog java os io for div amp log
#include<stdio.h> #include<string.h> #include<math.h> #include<iostream> #include<algorithm> #include<queue> #include<stack> #define mem(a,b) memset(a,b,sizeof(a)) #define ll __int64 #define MAXN 1000 #define INF 0x7ffffff #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 using namespace std; int a[300]; int main() { int t,n,m; int i,j; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); for(i=1;i<=n;i++) scanf("%d",&a[i]); int maxx=0; for(i=1;i<=n;i++) { int sum=0; for(j=i;j<=m+i-1;j++) { int temp=j; if(j>n) temp%=n; sum+=a[temp]; } if(maxx<sum) maxx=sum; } printf("%d\n",maxx); } return 0; }
zoj 3714 Java Beans,布布扣,bubuko.com
标签:blog java os io for div amp log
原文地址:http://www.cnblogs.com/sola1994/p/3920932.html