Codeforces Round #466 (Div. 2) Solution
从这里开始 题目列表 Problem A Points on the line Problem B Our Tanya is Crying Out Loud Problem C Phone Numbers Problem D Alena And The Heater Problem E Cashback Problem F Machine Learning Codeforces 940A Points on the line 题目大意 定义一个可重集的距离是它中间最大的两个数之间的差,特殊地,只有一个元素的可重集的距离为0。 给定一个可重集,问最少删掉多少个数使得它的距离小于等于d。 排序后单调指针扫,或者直接开桶计数。 Code 1 /* * 2 * Codeforces 3 * Problem#940A 4 * Accepted 5 * Time: 15ms 6 * Memory: 2000k 7 */ 8 #include <bits/stdc++.h> 9 using namespace std; 10 typedef bool boolean; 11 12 int n, d; 13 int res; 14 int * ar; 15 16 inline void init() { 17 scanf( " %d%d " , &n, & d); 18 ar =