思路:排个序,依次选就好了。

#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
#define PI acos((double)-1)
#define E exp(double(1))
#define K 1000+9
int a[K];
int main(void)
{
int t,cs=;cin>>t;
while(t--)
{
int n,m,sum=,x;
cin>>n>>m;
for(int i=;i<=n;i++)
scanf("%d",&a[i]);
sort(a+,a+n+);
x=a[];
for(int i=;i<=n;i++)
{
if(a[i]-x>m)
sum++;
x=a[i];
} printf("Case #%d: %d\n",cs++,sum);
} return ;
}

UVALive 6906 A - Cluster Analysis的更多相关文章

  1. UVALive 6906 Cluster Analysis 并查集

    Cluster Analysis 题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemi ...

  2. Cluster analysis

    https://en.wikipedia.org/wiki/Cluster_analysis Cluster analysis or clustering is the task of groupin ...

  3. cluster analysis in data mining

    https://en.wikipedia.org/wiki/K-means_clustering k-means clustering is a method of vector quantizati ...

  4. K-Means 聚类算法

    K-Means 概念定义: K-Means 是一种基于距离的排他的聚类划分方法. 上面的 K-Means 描述中包含了几个概念: 聚类(Clustering):K-Means 是一种聚类分析(Clus ...

  5. 地理信息系统 - ArcGIS - 高/低聚类分析工具(High/Low Clustering ---Getis-Ord General G)

    前段时间在学习空间统计相关的知识,于是把ArcGIS里Spatial Statistics工具箱里的工具好好研究了一遍,同时也整理了一些笔记上传分享.这一篇先聊一些基础概念,工具介绍篇随后上传. 空间 ...

  6. K-means聚类算法

    聚类分析(英语:Cluster analysis,亦称为群集分析) K-means也是聚类算法中最简单的一种了,但是里面包含的思想却是不一般.最早我使用并实现这个算法是在学习韩爷爷那本数据挖掘的书中, ...

  7. Bioinformatics Glossary

    原文:http://homepages.ulb.ac.be/~dgonze/TEACHING/bioinfo_glossary.html Affine gap costs: A scoring sys ...

  8. (转) Deep Learning Research Review Week 2: Reinforcement Learning

      Deep Learning Research Review Week 2: Reinforcement Learning 转载自: https://adeshpande3.github.io/ad ...

  9. Spark入门实战系列--8.Spark MLlib(下)--机器学习库SparkMLlib实战

    [注]该系列文章以及使用到安装包/测试数据 可以在<倾情大奉送--Spark入门实战系列>获取 .MLlib实例 1.1 聚类实例 1.1.1 算法说明 聚类(Cluster analys ...

随机推荐

  1. 第二百零六节,jQuery EasyUI,Menu(菜单)组件

    jQuery EasyUI,Menu(菜单)组件 学习要点: 1.加载方式 2.菜单项属性 3.菜单属性 4.菜单事件 5.菜单方法 本节课重点了解 EasyUI 中 Menu(菜单)组件的使用方法, ...

  2. C#获取CPU编号

    //System.Management;//需要添加引用(系统自带) /// <summary> /// 获取cpu编号 /// </summary> /// <retu ...

  3. (转)memcache、redis缓存

    memcache原理.内存模型: http://www.csdn.net/article/2016-03-16/2826609 redis原理: http://baike.baidu.com/link ...

  4. 《Start Developing iOS Apps Today》摘抄

    原文:<Start Developing iOS Apps Today> Review the Source Code 入口函数main.m #import <UIKit/UIKit ...

  5. Chem 3D中怎么创建立体模型

    ChemDraw作为一款很受大家欢迎的化学绘图软件,其在绘制平面化学方面的功能已经非常的强大了,其实它也可以绘制3D图形.Chem 3D就是绘制3D图形的重要组件.而且为了满足不同的用户绘图的需求,可 ...

  6. windows下用Eclipse连接大数据环境得hbase

    1.解压hbase安装包 2.将大数据环境得hadoop安装包拷贝到windows(这里以d:/hadoop为例) 3.打开C:\Windows\System32\drivers\etc目录下的hos ...

  7. 设置select选中某个option

    <select class="selector"></select> 1.设置value为pxx的项选中 $(".selector"). ...

  8. 自动更新本地 GIT 仓库

    随着开源软件的兴起,尤其是 GITHUB 的蓬勃发展,很多开源软件都通过 GIT 进行管理,在我的计算机上就一个目录是我关注并使用的开源软件 GIT 本地副本,如何定期更新这些仓库,一个个的更新太累人 ...

  9. Android无线测试之—UiAutomator UiObject API介绍七

    判断对象是否存在 1.判断对象是否存在相关API 返回值 API 描述 boolean waitForExists(long timeout) 等待对象出现 boolean waitUntilGone ...

  10. 第一次使用Xamarin就上手 - 安裝Xamarin

    http://xamarintech.blogspot.tw/2013/06/xamarin-xamarin-step-by-step-part1.html http://xamarintech.bl ...