hdoj 5199 Gunner map】的更多相关文章

Gunner Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5199 Description Long long ago, there is a gunner whose name is Jack. He likes to go hunting very much. One day he go to the grove. There are n birds and n…
Problem Description Long long ago, there is a gunner whose name is Jack. He likes to go hunting very much. One day he go to the grove. There are n birds and n trees. The i−thbird stands on the top of the i−th tree. The trees stand in straight line fr…
原题链接: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,…
题目传送门 /* 题意:问值为x的个数有几个,第二次查询就是0 lower/upper_bound ()函数的使用,map也可过,hash方法不会 */ #include <cstdio> #include <cmath> #include <cstring> #include <algorithm> #include <iostream> #include <vector> #include <set> #include…
题目传送门 /* 题意:查询x的id,每次前排的树倒下 使用lower_bound ()查找高度,f[i]记录第一棵高度为x树的位置,查询后+1(因为有序) */ #include <cstdio> #include <algorithm> #include <cstring> using namespace std; ; const int INF = 0x3f3f3f3f; struct A { int v, id; bool operator < (cons…
Gunner II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1740    Accepted Submission(s): 635 Problem Description Long long ago, there was a gunner whose name is Jack. He likes to go hunting ve…
Flying to the Mars 点我挑战题目 题意分析 有n个人,每个人都有一定的等级,高等级的人可以教低等级的人骑扫帚,并且他们可以共用一个扫帚,问至少需要几个扫帚. 这道题与最少拦截系统有异曲同工之妙.不同在于这道题可以排序,而最少拦截系统不能排序.我们想一下,把这些人排好序,并统计每个等级的人的个数.一次从最高等级到最低等级划掉一个人(可以理解为这些人互相教并且骑一个扫帚),一直划,直到最后一个人.这样可以看出来,扫帚的数量肯定是由某个等级的人数确定的.并且那个等级的人数最多.因此,…
Word Amalgamation 点我挑战题目 点我一起学习STL-MAP 题意分析 给出字典.之后给出一系列======乱序======单词,要求你查字典,如过这个乱序单词对用有多个有序单词可以输出,那么按照字典序将其输出. 若没有对应单词,输出NOT A VALID WORD. 可见这是一组组对应关系,可以用map来实现.map字典中first保存原本的单词(因为first按字典序),second保存原本单词排序后的单词.每次读入一个乱序单词后,sort遍历map并查找和second匹配的…
A + B 点我挑战题目 点我一起学习STL-MAP 题意分析 讲字符串和数字用map对应即可 代码总览 /* Title:HDOJ.1228 Author:pengwill Date:2016-11-21 */ #include <iostream> #include <map> #include <string> using namespace std; typedef map<string,int> mmp; mmp p; mmp::iterator…
单词数 点我挑战题目 点我一起学习STL-MAP 题意分析 给出一行单词,判断这行有不同种的单词多少个,用map可以轻松解决. 代码总览 /* Title:HDOJ.2072 Author:pengwill Date:2016-11-21 */ #include <iostream> #include <map> #include <stdio.h> #include <string> #include <string.h> #define ma…