-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1538B.cpp
61 lines (54 loc) · 1.14 KB
/
1538B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <functional>
#include <set>
#include <queue>
#include <sstream>
using namespace std;
using p = pair<int, int>;
using ll = long long;
const int MAX = 10e+6;
const int INF = 0x66554433;
vector<string> split(string input, char delimiter) {
vector<string> answer;
stringstream ss(input);
string temp;
while (getline(ss, temp, delimiter)) {
answer.push_back(temp);
}
return answer;
}
inline void Quick_IO() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int main() {
Quick_IO();
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
ll arr[n];
ll total = 0;
for (int i = 0; i < n; ++i) {
cin >> arr[i];
total+=arr[i];
}
if(total%n!=0){
cout<<-1<<'\n';
}else{
ll avg = total/n;
int counts = 0;
for (int i = 0; i < n; ++i) {
if(arr[i]-avg>0) counts++;
}
cout<<counts<<'\n';
}
}
return 0;
}