hdu 5199 Gunner
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5199
简单题,stl水之。。。
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cstdio>
#include<set>
#include<map>
using std::map;
map<int, int> rec;
int main() {
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w+", stdout);
#endif
int n, v, k;
while (~scanf("%d %d", &n, &k)) {
for (int i = ; i < n; i++) {
scanf("%d", &v);
rec[v]++;
}
while (k--) {
scanf("%d", &v);
map<int, int>::iterator ite = rec.lower_bound(v);
if (ite == rec.end() || ite->first > v) puts("");
else printf("%d\n", ite->second), rec.erase(v);
}
}
return ;
}
hdu 5199 Gunner的更多相关文章
- hdu 5199 Gunner(STL之map,水)
Problem Description Long long ago, there is a gunner whose name is Jack. He likes to go hunting very ...
- hdoj 5199 Gunner map
Gunner Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5199 D ...
- hdu 5233 Gunner II
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5233 简单题,stl水之... #include<algorithm> #include& ...
- HDU 5233 Gunner II 离散化
题目链接: hdu:http://acm.hdu.edu.cn/showproblem.php?pid=5233 bc(中文):http://bestcoder.hdu.edu.cn/contests ...
- 二分查找 BestCoder Round #36 ($) Gunner
题目传送门 /* 题意:问值为x的个数有几个,第二次查询就是0 lower/upper_bound ()函数的使用,map也可过,hash方法不会 */ #include <cstdio> ...
- BestCoder36 1002.Gunner 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5199 题目意思:给出鸟在树上的高度,以及射击到的高度,问每次射击能射中鸟的数量 用 vector 里面 ...
- BestCoder Round #36 [B] Gunner
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=5199 先对树的高度排序,然后对每次射击高度二分查找即可,打过之后数目变为0. #include< ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
随机推荐
- DownLoadFile - FileHandler
C# 跳转新页面 判断URL文件是不是在于在. C# 指定物理目录下载文件,Response.End导致“正在中止线程”异常的问题 public class FileHandler { public ...
- namespace的用法
C++中采用的是单一的全局变量命名空间.在这单一的空间中,如果有两个变量或函数的名字完全相同,就会出现冲突.当然,你也可以使用不同的名字,但有时我们并不知道另一个变量也使用完全相同的名字:有时为了程序 ...
- SQLServer 窗口函数
一.窗口函数的作用 窗口函数是对一组值进行操作,不需要使用GROUP BY 子句对数据进行分组,还能够在同一行中同时返回基础行的列和聚合列.窗口函数,基础列和聚合列的查询都非常简单. 二.语法格式 窗 ...
- ASP.NET的SEO:目录
ASP.NET的SEO:基础知识 ASP.NET的SEO:Global.asax和HttpModule中的RewritePath()方法--友好的URL ASP.NET的SEO:正则表达式 ASP.N ...
- 解决 FastReport 使用存储过程 找不到临时表问题
在存储过程最开始加入:以下命令就可以了 SET FMTONLY OFF 有时候在执行SQL查询语句时,仅仅需要知道检索的元数据,而不是具体的数据行,可以设置SET FMTONLY ON. SET FM ...
- iTunes - Forensic guys' best friend
What chances do you think to acquire suspect's data from his/her iDevice? If suspects also use iTune ...
- Windows服务中用Timer和线程两种方式来执行定时任务
在Service服务文件夹下新建Windows服务 - TestService
- IOS学习感想
1.一开始学习的时候将会感到非常的难,即使自己曾经学过C/JAVA/HTML/CSS/JS/PHP等,但是对于学过C++的人来说,我就不知道了.因为它的语法不同于任何一门语言,所以说入门难是正常的.但 ...
- Nginx 403 forbidden的解决办法
Nginx 403 forbidden的解决办法. 常见的,引起nginx 403 forbidden有二种原因,一是缺少索引文件,二权限问题. 1.缺少index.html或者index.php文件 ...
- Java求和
用while结构求0~100的整数数字之和. 代码如下: public class WhileDemo { public static void main(String[] args) { int l ...