刷题——hdu 6095 Rikka with Competition
来源:互联网 发布:drupal建站 编辑:程序博客网 时间:2024/05/18 02:24
/*
先排序,从大开始遍历,到不满足a[i]-a[j]<=k或i==0,则最后只有n-i个人胜利
*/
#include <stdio.h>
#include <algorithm>using namespace std;
int a[100005];
int main(){
int t;
scanf("%d",&t);
while(t--){
int n,k;
scanf("%d %d",&n,&k);
for(int i=0;i<n;i++){
scanf("%d",&a[i]);
}
sort(a,a+n);
int sum=1;
for(int i=n-2;i>=0;i--){
if(a[i+1]-a[i]>k){
break;
}
sum++;
}
printf("%d\n",sum);
}
return 0;
}
阅读全文
0 5
- 刷题——hdu 6095 Rikka with Competition
- HDU 6095 Rikka with Competition
- HDU 6095 Rikka with Competition
- hdu 6095-Rikka with Competition
- HDU 6095 Rikka with Competition【】
- hdu 6095-Rikka with Competition
- HDU 6095 Rikka with Competition
- 多校5 HDU-6095 Rikka with Competition
- HDU 6095 Rikka with Competition(思维)
- HDU 6095 Rikka with Competition(水~)
- HDOJ 6095-Rikka with Competition
- 2017多校五 1011题 hdu 6095 Rikka with Competition
- HDU 6095 Rikka with Competition【阅读题】【水题】
- hdu 多校联赛 Rikka with Competition
- Rikka with Competition(HDU 609)
- hdu2639 Rikka with Competition
- HDU6095 Rikka with Competition
- Rikka with Competition
- AngularJS内幕详解之 Scope
- 【Spring】Spring Framework Reference Documentation中文版36
- hdu6085 Rikka with Candies [bitset+想法]
- 【NOI2006】最大获利 最大权闭合图+最小割
- 又到了大家最喜欢的学习时间
- 刷题——hdu 6095 Rikka with Competition
- 我的百度网盘分享链接
- IBeginDragHandlerinterface in UnityEngine.EventSystems
- Android学习之SharedPerference存储
- IBeginDragHandl位于 UnityEngine.EventSystems下
- linux 常用命令
- easy ui Tree 的使用
- Java
- CentOS7下搭建MQTT(Mosquitto)