首页 > 代码库 > ZOJ3714JavaBeans

ZOJ3714JavaBeans

1 #!/usr/bin/env python2 # encoding: utf-83 t = int(raw_input())4 for i in range(t):5     n,k = [int(x) for x in raw_input().split( )]6     lst = [int(x) for x in raw_input().split( )]7     ans = max(sum((lst*2)[j:j+k]) for j in range(n))8     print ans

一个水题.给n,和k.然后求一个循环序列的连续k个数求和最大值.python6行..

ZOJ3714JavaBeans