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 ...
随机推荐
- [codevs5578][咸鱼]tarjan/结论题
5578 咸鱼 时间限制: 1 s 空间限制: 128000 KB 题目描述 Description 在广袤的正方形土地上有n条水平的河流和m条垂直的河流,发达的咸鱼家族在m*n个河流交叉点都 ...
- 洛谷P1218 [USACO1.5]特殊的质数肋骨 Superprime Rib
P1218 [USACO1.5]特殊的质数肋骨 Superprime Rib 284通过 425提交 题目提供者该用户不存在 标签USACO 难度普及- 提交 讨论 题解 最新讨论 超时怎么办? ...
- java中List Set Map使用
@Test public void run() { ArrayList<String> list= ...
- 【Spring 2】spring的属性注入形式
一.注入简介 spring是一个java bean的容器,它摒弃了过去通过new关键字调用类再调用类的实例的形式,通过依赖注入维护者一系列的java bean的示例.通过spring所提供的依赖注入 ...
- mysql时间日期相加相减实现
分享篇mysql中日期的一些操作,就是我们常常会用到的mysql时间日期的相加或者相减的了,这个mysql也自己带了函数,有需要的朋友可以参考一下. 最简单的方法 select TO_DAYS(str ...
- Date获取时间段
/** * */ package com.chinabase.common.util; /** * @author yuanji * @created on:Sep 19, 2008 */ impor ...
- WWF3事务和异常处理类型活动<第四篇>
一.FaultHandler 添加一个工作流图如下: 首先添加一个Seruence,在里面添加3个Code,外面添加一个Code,打开Seruence错误处理,在容器里添加一个faultHandler ...
- Chrome调试(debugger)总是进入paused in debugger状态
在通过Chrome浏览器进行web前端开发时,我们会经常用到Chrome自带的debugger工具,但是经常按完快捷键(F12)后,页面会进入 paused in debugger状态,需要点击右上角 ...
- C++读取ini文件的类
取自:http://www.viksoe.dk/code/all_mfc.htm,里面有各种MFC常用的类 // Ini.h: interface for the CIni class. // // ...
- 【好文要转】Python:模拟登录以获取新浪微博OAuth的code参数值
[转自]http://www.tuicool.com/articles/zAz6zi [原文]http://blog.segmentfault.com/hongfei/1190000000343851 ...