首页 > 其他 > 详细

hdu 5199 Gunner

时间:2015-05-28 22:58:44      阅读:401      评论:0      收藏:0      [点我收藏+]

原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=5199 
简单题,stl水之。。。

技术分享
 1 #include<algorithm>
 2 #include<iostream>
 3 #include<cstdlib>
 4 #include<cstring>
 5 #include<cstdio>
 6 #include<set>
 7 #include<map>
 8 using std::map;
 9 map<int, int> rec;
10 int main() {
11 #ifdef LOCAL
12     freopen("in.txt", "r", stdin);
13     freopen("out.txt", "w+", stdout);
14 #endif
15     int n, v, k;
16     while (~scanf("%d %d", &n, &k)) {
17         for (int i = 0; i < n; i++) {
18             scanf("%d", &v);
19             rec[v]++;
20         }
21         while (k--) {
22             scanf("%d", &v);
23             map<int, int>::iterator ite = rec.lower_bound(v);
24             if (ite == rec.end() || ite->first > v) puts("0");
25             else printf("%d\n", ite->second), rec.erase(v);
26         }
27     }
28     return 0;
29 }
View Code

 

hdu 5199 Gunner

原文:http://www.cnblogs.com/GadyPu/p/4537129.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!