ZOJ3714JavaBeans

1 #!/usr/bin/env python
2 # encoding: utf-8
3 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行..

时间: 2024-10-15 19:56:48

ZOJ3714JavaBeans的相关文章