2829. k-avoiding 数组的最小总和 题目链接:2829. k-avoiding 数组的最小总和 代码如下: class Solution { public:int minimumSum(int n, int k) {int m = min(k / 2, n);return (m * (m + 1) + (k * 2 + n - m - 1) * (n - m)) / 2;} };