- 博客(16)
- 资源 (4)
- 收藏
- 关注
原创 【map】【set】poj 3297
1. 每个项目的有效报名人数 --> map --> map mapNum4Prj2. 局部(当前项目)报名学生 --> set --> set setStu4Curr用于检测当前项目中该学生是否是第一次出现3. 全局学生报名的第一个项目 --> map --> map mapFirstPrj两个作用: (1) 用于检测该学生是否已经报名过其它项目 (2) 记录
2014-04-18 20:07:48 829
原创 【map】【multiset】hdu 4022
1. 可能有重复点(这一点题目并没有说明),因此 set 行不通2. 用 C++ 的 cin, cout 超时
2014-04-18 12:34:07 802
原创 STL中map,multimap,set,multiset,unordered_map,unordered_multimap,unordered_set,unordered_multiset的实现方法
1. set, multiset, map, multimap, unordered_map
2014-04-15 19:30:12 2614
原创 【优先队列】【priority_queue】【getline】【istringstream】hdu 1873
此题需要注意2点:1. 重载 "2. 由于每组数据处理完之后,队列并没有 pop 空,但 priority_queue 又没有提供清空队列的方法,所以只能每组数据都重新创建对象/** * hdu 1873 * 【优先队列】【priority_queue】 * 此题需要注意2点: * 1. 重载 "<" 的语义:当优先级相等时,先到的优先级高,不能指望 * priorit
2014-04-12 23:34:07 815
原创 【优先队列】【堆】STL之priority_queue、make_heap()、push_heap()、pop_heap()、容器适配器
explicit priority_queue (const Compare& comp = Compare(), const Container& ctnr = Container());template priority_queue (InputIterator first, InputIterator last, const Compare& comp = Comp
2014-04-11 21:46:45 1714
原创 【双端队列】【栈】【队列】STL之deque、stack、queue、容器适配器
hexplicit deque (const allocator_type& alloc = allocator_type());explicit deque (size_type n, const value_type& val = value_type(), const allocator_type& alloc = allocator_type());template
2014-04-11 19:58:39 1293
原创 函数调用符重载
#include // std::cout#include // std::minus#include // std::accumulatestruct myclass{ int operator()(int x, int y) { return x+3*y; }};int main (){ int in
2014-04-09 21:14:08 790
原创 【STL】<algorithm><numeric><functional> 中的常用算法
1. find1. 从 first 到 last 顺序和 val 比较2. 比较操作符 "=="http://www.cplusplus.com/reference/algorithm/find/
2014-04-09 16:23:37 1284
原创 【队列】poj 3125
/* * poj 3125 * http://poj.org/problem?id=3125 * 【队列】此题不适用用 STL 做,反而会是操作麻烦 * 思路:找到第一个优先级最高的任务处理掉,其前面的任务插入队尾。 * 1. 为了节省空间,实际操作不移动最大优先级任务之前的任务,而是将 * 头指针指向后面一个任务,队列循环使用。 * 2. 已经处理掉的任务优先级设为 0 *
2014-04-08 18:26:40 1352
原创 C/C++ 字符串与数字相互转化方法小结
1. 字符串 --> 数字ato: atoi(), atol(), atoll(), atof()strto: strtol(), strtoul(), strtod()strto 是 ato 的升级版:(1) strto 支持转化成多种进制(2) ato 对错误情况的处理很不完善, strto 对完善了错误处理2. 数字 --> 字符串(1) sprint
2014-04-08 10:16:51 3063
原创 【STL】ostringstream, istringstream, stringstream
#include #include #include using namespace std;int main(){ /* * ostringstream * 可以理解为将输出重定向至 ostringstream 对象(内存区域) */ ostringstream oss; oss << 3.1415926 << " " << 3.
2014-04-08 10:09:39 1565
原创 【栈】【双端队列】【stack】【deque】hdu 4286
http://acm.hdu.edu.cn/showproblem.php?pid=4286sh
2014-04-07 22:05:31 1010
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人