# 517.超级洗衣机

## 问题描述
[517.超级洗衣机](https://leetcode.cn/problems/super-washing-machines/)

## 解题思路
参照[直观清晰：理解官方题解——超级洗衣机](https://leetcode.cn/problems/super-washing-machines/solutions/1023905/zhi-guan-qing-xi-li-jie-guan-fang-ti-jie-vxxs/)和[贪心,再动一点点脑子](https://leetcode.cn/problems/super-washing-machines/solutions/451378/tan-xin-zai-dong-yi-dian-dian-nao-zi-by-whiteashes/)。

这个题我也还没搞懂，先搁置

## 代码
```cpp
class Solution {
public:
    int findMinMoves(vector<int> &machines) {
        int tot = accumulate(machines.begin(), machines.end(), 0);
        int n = machines.size();
        if (tot % n) {
            return -1;
        }
        int avg = tot / n;
        int ans = 0, sum = 0;
        for (int num: machines) {
            num -= avg;
            sum += num;
            ans = max(ans, max(abs(sum), num));
        }
        return ans;
    }
};
```

