HDU 6095 Rikka with Competition
2017-08-08 19:37
387 查看
题目地址
题意:告诉你n个人的能力值,求出最后的赢家会有哪些。他的获胜条件要不是赢得那方的能力值减去输的那方的能力值,或者随机赢
思路:排序,从大到小去找,知道有一个是一定赢得为止,遍历过的数就是最后的可能的赢家数量
题意:告诉你n个人的能力值,求出最后的赢家会有哪些。他的获胜条件要不是赢得那方的能力值减去输的那方的能力值,或者随机赢
思路:排序,从大到小去找,知道有一个是一定赢得为止,遍历过的数就是最后的可能的赢家数量
#include <iostream> #include <cstring> #include <string> #include <queue> #include <vector> #include <map> #include <set> #include <stack> #include <cmath> #include <cstdio> #include <algorithm> #define N 100010 #define LL __int64 #define lson l,mid,ans<<1 #define rson mid+1,r,ans<<1|1 #define getMid (l+r)>>1 #define movel ans<<1 #define mover ans<<1|1 using namespace std; const LL mod = 1e9 + 7; const double eps = 1e-9; const int inf = 1 << 28; LL num ; int main() { cin.sync_with_stdio(false); int T; int n, m; cin >> T; while (T--) { cin >> n >> m; for (int i = 0; i < n; i++) { cin >> num[i]; } sort(num, num + n); int ans = 1; for (int i = n - 2; i >= 0; i--) { if (num[i + 1] - num[i] > m) { break; } ans++; } cout << ans << endl; } return 0; }
相关文章推荐
- 多校5 HDU-6095 Rikka with Competition
- hdu 6095-Rikka with Competition
- HDU 6095 17多校5 Rikka with Competition(思维简单题)
- Rikka with Competition hdu 6095
- 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 -2017多校联盟5 第11题
- hdu 多校联赛 Rikka with Competition
- Rikka with Competition(HDU 609)
- HDU6095 Rikka with Competition(水题,2017 HDU多校联赛 第5场)
- hdu2639 Rikka with Competition
- HDOJ 6095-Rikka with Competition
- hdu_5831_Rikka with Parenthesis II(模拟)
- hdu 6092 Rikka with Subset
- Rikka with Graph hdu 6090
- Rikka with Subset(HDU 6092)