HDUOJ --2523
#include<iostream>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<functional>
using namespace std;
bool hash[];
int main()
{
int c,n,k,i,j;
scanf("%d",&c);
while(c--)
{
scanf("%d%d",&n,&k);
memset(hash,,sizeof(hash));
vector<int>sav(n);
for(i=;i<n;i++)
scanf("%d",&sav[i]);
sort(sav.begin(),sav.end(),less<int>());
for(i=;i<n;i++)
{
for(j=i+;j<n ;j++)
{
hash[sav[j]-sav[i]]=true;
}
}
for(i=;i<=&&k>;i++)
{
if(hash[i]) k--;
}
printf("%d\n",i-);
}
return ;
}
想到过很多方法,都超时了,看了别人的代码,才发现,有这么一出,居然没想到...爱,菜鸟,终究是菜鸟...
HDUOJ --2523的更多相关文章
- hduoj 1455 && uva 243 E - Sticks
http://acm.hdu.edu.cn/showproblem.php?pid=1455 http://uva.onlinejudge.org/index.php?option=com_onlin ...
- hduoj 4712 Hamming Distance 2013 ACM/ICPC Asia Regional Online —— Warmup
http://acm.hdu.edu.cn/showproblem.php?pid=4712 Hamming Distance Time Limit: 6000/3000 MS (Java/Other ...
- hduoj 4706 Herding 2013 ACM/ICPC Asia Regional Online —— Warmup
hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup Herding Time Limit: 2000/1000 ...
- SDUT 2523 OOXX
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2523 思路 :就是先统计一下方阵中1多少2多少 ...
- hdu-oj 1874 畅通工程续
最短路基础 这个题目hdu-oj 1874可以用来练习最短路的一些算法. Dijkstra 无优化版本 #include<cstdio> #include<iostream> ...
- C#版 - HDUoj 5391 - Zball in Tina Town(素数) - 题解
版权声明: 本文为博主Bravo Yeung(知乎UserName同名)的原创文章,欲转载请先私信获博主允许,转载时请附上网址 http://blog.csdn.net/lzuacm. HDUoj 5 ...
- C++版 - HDUoj 2010 3阶的水仙花数 - 牛客网
版权声明: 本文为博主Bravo Yeung(知乎UserName同名)的原创文章,欲转载请先私信获博主允许,转载时请附上网址 http://blog.csdn.net/lzuacm. C++版 - ...
- HDUOJ题目HTML的爬取
HDUOJ题目HTML的爬取 封装好的exe/app的GitHub地址:https://github.com/Rhythmicc/HDUHTML 按照系统选择即可. 其实没什么难度,先爬下来一个题目的 ...
- hduoj题目分类
基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.1032.1037.1040.1048.1056.1058.1 ...
随机推荐
- 深入分析JavaWeb Item7 -- HttpServletResponse详解
Web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象.和代表响应的response对象.request和response对象即然代表请求和响应,那我们要 ...
- 已有数据库(单机)部署Database Vault
1.停止em和数据库 emctl stop dbconsole shutdown immediate 2.又一次安装DB软件 ./runInstaller 选组件的时候,选中"Oracle ...
- WhyEngine游戏引擎作品合集
从9月份开始写三个月内总共实现了13个游戏,5个屏保程序,5个DEMO程序.如果运行时,报有木马病毒什么的,请相信我,这绝对是杀毒软件的误报,自己写的程序由于没有得到杀毒软件的认证,被报有危险是正常的 ...
- Visual Studio Code 构建C/C++开发环境
转自: https://blog.csdn.net/lidong_12664196/article/details/68928136#visual-sutdio-code%E4%BB%A5%E5%8F ...
- 第五章 类加载器ClassLoader源码解析
说明:了解ClassLoader前,先了解 第四章 类加载机制 1.ClassLoader作用 类加载流程的"加载"阶段是由类加载器完成的. 2.类加载器结构 结构:Bootstr ...
- c++ placement new概念
参考:http://www.cnblogs.com/Clingingboy/archive/2013/04/26/3044910.html 转:http://bbs.chinaunix.net/thr ...
- 在 Linux 中永久修改 USB 设备权限
问题 当我尝试在 Linux 中运行 USB GPS 接收器时我遇到了下面来自 gpsd 的错误.看上去 gpsd 没有权限访问 USB 设备(/dev/ttyUSB0).我该如何永久修改它在Linu ...
- yeoman-angular-gulp
1.安装 yeoman npm install -g yo gulp bower 2.安装genarate-angular //npm install generator-angular npm in ...
- [Backbone] First Application!!!!
Important things to remember: 1. Usually, we create Collection, CollectionViews, Model, View. Collec ...
- 缺少dll文件的解决方法
1.什么是dll文件 从专业的角度来说,dll文件,即动态连接库,是一种不可执行的二进制文件,它允许程序共享执行特殊任务所必需的代码和其他资源.打个比方,相当于你去饭店吃饭,只人带上钱或卡就可以了,不 ...