Rikka with Competition hdu 6095
2017-08-08 20:35
447 查看
签到题目,排序然后按序清理掉一定会输的结果就可以。
ac代码:
ac代码:
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int a[100001]; int main() { int t; cin>>t; while(t--) { int n,k; int sum=0; scanf("%d %d",&n,&k); for(int i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+n); int vis[100001]; memset(vis,0,sizeof(vis)); sum=0; for(int j=n-1;j>=0;j--) { int temp=j-1; if(vis[j]) continue; while(a[j]-a[temp]>k && temp>=0) { sum++; vis[temp]=1; temp--; } } cout<<n-sum<<endl; } return 0; }
相关文章推荐
- HDU 6095 Rikka with Competition
- HDU 6095 17多校5 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 第11题
- 多校5 HDU-6095 Rikka with Competition
- hdu 6095-Rikka with Competition
- HDU6095 Rikka with Competition(水题,2017 HDU多校联赛 第5场)
- hdu2639 Rikka with Competition
- HDOJ 6095-Rikka with Competition
- hdu 多校联赛 Rikka with Competition
- Rikka with Competition(HDU 609)
- HDU 5828 Rikka with Sequence(线段树)
- HDU 5831 Rikka with Parenthesis II(机智)
- hdu 5423 Rikka with Tree(思路)
- hdu 6092 Rikka with Subset