-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1334B.cpp
51 lines (49 loc) · 1.04 KB
/
1334B.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
#include <bits/stdc++.h>
using namespace std;
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define ll long long
#define ld long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp make_pair
#define ff first
#define ss second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define endl "\n"
#define fo(i,n) for(int i=0;i<n;i++)
#define foo(i,x,n) for(int i=x;i<n;i++)
const ll MOD = 1000*1000*1000+7;
const ll MOD2 = 998244353;
const ll N = 1000*1000+5;
const double PI = 3.14159265;
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
bool comp(double a,double b){
return a>b;
}
int main(){
fastio();
int t;
cin>>t;
while(t--){
int n,x;
cin>>n>>x;
double a[n];
double sum=0;
int count=0;
for(int i=0;i<n;i++){
cin>>a[i];
sum+=a[i];
}
sort(a,a+n,comp);
for(int i=n-1;i>=0;i--){
if((sum/(i+1))>=x){
count+=(i+1);
break;
}
sum-=a[i];
}
cout<<count<<endl;
}
}