码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 6095: Rikka with Competition

时间:2017-08-08 21:43:21      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:round   tor   ace   bit   family   sort   ext   date   for   

Rikka with Competition

 

///@author Sycamore
///@date 8/8/2017
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	int t;
	cin >> t;
	while (t--)
	{
		int n, k;
		cin >> n >> k;
		vector<int>v(n);
		for (auto &: v)cin >> e;
		int cnt = 1;
		sort(v.begin(), v.end());
		for (int i = n - 1; i>0; i--)
		{
			if (v[i] - v[- 1] <= k)cnt++;
			else break;
		}
		cout << cnt << endl;
	}
	return 0;
}

 

HDU 6095: Rikka with Competition

标签:round   tor   ace   bit   family   sort   ext   date   for   

原文地址:http://www.cnblogs.com/zjnu/p/7308889.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!