原题地址
这道题很简单 , 题意就是说有n个筐子 , 里面有不定量的石头。然后作者想让你把所有筐子的石头给平均一下。
然后条件是:
1.Remove a stone from one of the non-empty buckets.
2.Move a stone from one of the buckets (must be non-empty) to any other bucket (can be empty).
自己在这里犯傻了, 把2里面的can be empty 理解成了只能往空的筐子里放石头。。。
然后就是自己数组开得太大了, 来了几次SF。。。
附上代码:

#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<set>
#include<cstring>
using namespace std;

int main()
{
	int t;
	cin >>t;
	while(t--){
        long long  a ;
        cin >>a;
        long long  b[a+1];
        memset(b,0,sizeof(b));
        long long sum=0;
        for(long long i=0;i<a;i++){
            cin >>b[i];
            sum +=b[i];
        }
        long long  Count=0;
        sum /=a;
        for(long long  i=0;i<a;i++){
            if(b[i]>sum){
                Count +=b[i] - sum;
            }
            /*else{
                Count +=sum - b[i];
            }*/

        }
        cout<<Count <<endl;
	}
	return 0;
}