第一题,不知道问题在哪 import sys if __name__ == "__main__": line1 = sys.stdin.readline().strip() n, k = list(map(int, line1.split())) line = sys.stdin.readline().strip() # 把每一行的数字分隔后转化成int列表 values = list(map(int, line.split())) print(n,k,values) def cal(n, k, values): ans = -1 if k == n: return 1 res = sum(values[:k]) head, tail = 1, k + 1 while tail <= len(values): if sum(values[head:tail]) < res: res = sum(values[head:tail]) ans = head + 1 head += 1 tail += 1 return ans print(cal(n, k, values))