n, k =map(int,input().split())
a =list(map(int,input().split()))s =[0]*(n +1)for i inrange(n):s[i +1]= s[i]+ a[i]**2defcheck(x):res =0i =0while i < n:start = iif s[start +1]- s[start]> x:returnFalsei +=1while i < n and s[i +1]- s[start]<= x:i +=1res +=1return res <= kl, r =0, s[n]- s[0]while l < r:mid =(l + r)>>1if check(mid):r = midelse:l = mid +1print(l)
估计mongodb数据库没开启,或者链接错误了,谁又改了,唉
2023-11-29 16:19:45.818 INFO 39552 --- [127.0.0.1:27017] org.mongodb.driver.cluster : Exception in monitor thread while connecting to server 127.0.0.1:27017…