标签:style blog color sp java for on div log
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行..
标签:style blog color sp java for on div log
原文地址:http://www.cnblogs.com/shengrang/p/4109900.html