-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchfm.cpp
More file actions
37 lines (34 loc) · 798 Bytes
/
chfm.cpp
File metadata and controls
37 lines (34 loc) · 798 Bytes
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
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
long double mean(vector<long double>& v, lli n){
long double sum = 0.0;
for(lli i = 0; i < v.size(); i++){
sum+=v[i];
}
return (sum/n);
}
int main(){
lli test, N;
cin >> test;
while(test--){
cin >> N;
vector<long double> v(N);
for(lli i = 0; i < N; i++){
cin >> v[i];
}
long double num = mean(v, N);
lli flag = -1;
for(lli i = 0; i < N; i++){
if(num == v[i]){
flag = i;
break;
}
}
if(flag != -1)
cout << flag + 1 << "\n";
else
cout << "Impossible" << "\n";
}
return 0;
}