待补

#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
map <LL , int> mp;
int main()
{
	int T;
	scanf("%d",&T);
	while(T--){
		int n , res = 0;
	    LL sum = 0 , num;
	    scanf("%d" , &n);
	    for(int i = 0 ; i < n ; ++i) {
	        scanf("%lld" , &num);
	        sum += num;
	        mp[sum]++;
	        res = max(res , mp[sum]);
	    }
	    printf("%d\n" , n - res);
	    mp.clear();
	}
    
}

猜你喜欢

转载自blog.csdn.net/cgmm2333/article/details/82227540