bbb

bool check(int mid){
  int sum=0,sumL=0;
  for(int i=1;i<=L;i++) sum += a[i] = mid;
  int MaxSum = -inf ,MinSum=inf;
  for(int i=L;i<=n;i++){
    MaxSum = max(MaxSum,sum-MinSum);
    sum += a[i+1]-mid;
    MinSum = min(MinSum,sumL);
  }
  return MaxSum >= 0;
}

 

上一篇:uni-app打包h5白屏问题


下一篇:MySQL 使用AVG聚合函数时,保留两位小数的方法