多校5 HDU-6095 Rikka with Competition
来源:互联网 发布:a5淘宝客 编辑:程序博客网 时间:2024/06/02 01:58
水题
原题链接:
HDU-6095
大意:
摔跤比赛,n 个人的能力为
思路:一开始被英文题绕死。
考虑最优情况。
代码实现:
#include <bits/stdc++.h>using namespace std;typedef long long ll;#define mem(s,t) memset(s,t,sizeof(s))#define D(v) cout<<#v<<" "<<v<<endl#define inf 0x3f3f3f3f//#define LOCALinline void read(int &x){ x=0;char p=getchar(); while(!(p<='9'&&p>='0'))p=getchar(); while(p<='9'&&p>='0')x*=10,x+=p-48,p=getchar();}const int N =1e5+10;int a[N];int main() {#ifdef LOCAL freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);#endif int t; read(t); while(t--){ int n,K; read(n);read(K); for(int i=1;i<=n;i++){ read(a[i]); } sort(a+1,a+n+1); int i; for(i=n;i>1;i--){ if(a[i]-a[i-1]>K){ break; } } printf("%d\n",n-i+1); } return 0;}
阅读全文
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
- HDU 6095 Rikka with Competition(思维)
- HDU 6095 Rikka with Competition(水~)
- 2017多校5 1011 Rikka with Competition
- HDOJ 6095-Rikka with Competition
- 刷题——hdu 6095 Rikka with Competition
- 2017多校五 1011题 hdu 6095 Rikka with Competition
- HDU 6095 Rikka with Competition【阅读题】【水题】
- HDU 2017 多校联赛5 1011 Rikka with Competition
- HDU 6095 Rikka with Competition -2017多校联盟5 第11题
- hdu 多校联赛 Rikka with Competition
- Rikka with Competition(HDU 609)
- java中的一些数据格式的声明、使用(一)
- layer icon图标汇总
- 发送Ajax请求
- codeforces [Gym-100814E]
- Lua 为什么在游戏编程领域被广泛运用?
- 多校5 HDU-6095 Rikka with Competition
- 框架嵌套事务
- 为树莓派打造一个安全关机的功能,不需要命令行,不需要额外电路板!
- 6---LeetCode【tag: Array】【Rotate Array】|C语言|总结
- SpringMVC启动过程详解
- 20. Valid Parentheses
- Linux 挂载移动硬盘,使其内部文件有可执行权限
- Java并发编程好文
- log4j2使用