B. Team Training

time limit per test

2 seconds

memory limit per test

256 megabytes

At the IT Campus "NEIMARK", there are training sessions in competitive programming — both individual and team-based!

For the next team training session, nn students will attend, and the skill of the ii-th student is given by a positive integer aiai.

The coach considers a team strong if its strength is at least xx. The strength of a team is calculated as the number of team members multiplied by the minimum skill among the team members.

For example, if a team consists of 44 members with skills [5,3,6,8][5,3,6,8], then the team's strength is 4⋅min([5,3,6,8])=124⋅min([5,3,6,8])=12.

Output the maximum possible number of strong teams, given that each team must have at least one participant and every participant must belong to exactly one team.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1≤t≤1041≤t≤104). The description of the test cases follows.

The first line of each test case contains two integers nn and xx (1≤n≤2⋅1051≤n≤2⋅105, 1≤x≤1091≤x≤109) — the number of students in training and the minimum strength of a team to be considered strong.

The second line of each test case contains nn integers aiai (1≤ai≤1091≤ai≤109) — the skill of each student.

It is guaranteed that the sum of nn over all test cases does not exceed 2⋅1052⋅105.

Output

For each test case, output the maximum possible number of teams with strength at least xx.

Example

Input

Copy


5

6 4

4 5 3 3 2 6

4 10

4 2 1 3

5 3

5 3 2 3 2

3 6

9 1 7

6 10

6 1 3 6 3 2

Output

Copy

4
0
4
2
1

2

解题说明:此题可以采用贪心算法,首先对数列从小到大进行排序,从尾部开始遍历,如果数字本身大于x,那单独就能组成一个队伍,否则计算某个区间内的最小值乘以数目是否大于x,满足条件的话组成一个队伍。

#include<iostream>
#include<algorithm>
using namespace std;
int t, x, n, a[200100], ans;
int main()
{
	cin >> t;
	while (t--)
	{
		scanf("%d%d", &n, &x);
		for (int i = 1; i <= n; i++)
		{
			scanf("%d", &a[i]);
		}
		ans = 0;
		sort(a + 1, a + n + 1);
		int la = n + 1;
		for (int i = n; i >= 1; i--)
		{
			if (a[i] * (la - i) >= x)
			{
				la = i;
				ans++;
			}
		}
		cout << ans << "\n";
	}
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值