二维 map map >map.find(x) 查找,如果没有返回值是 map.end()bool(map[x]) 查找,但是一旦访问下标那么就会产生一个节点map.empty() 判空map.size() 大小
分类:
其他好文 时间:
2014-08-13 00:44:54
阅读次数:
206
这明明就是给纯C选手的大杀器啊。题意:给你k坐标,表示 X,Y 有值C,有 3种操作1) 交换A,B两行2) 交换A,B两列3) 询问(A,B)的值解题思路:map离散化解题代码:// File Name: 1007.cpp// Author: darkdream// Created Time: 2...
分类:
其他好文 时间:
2014-08-13 00:39:44
阅读次数:
259
hdu 4941 Magical Forest(STL map & 结构体运用)...
分类:
其他好文 时间:
2014-08-12 22:15:54
阅读次数:
382
STL简介
C++ STL (Standard Template Library标准模板库) 是通用类模板和算法的集合,它提供给程序员一些标准的数据结构的实现如 queues(队列), lists(链表), 和 stacks(栈)等. C++ STL 提供给程序员以下三类数据结构的实现: 标准容器类 顺序性容器 vector 从后面快速的插入与删除,直接访问任何元素 deque 从...
分类:
其他好文 时间:
2014-08-12 22:08:44
阅读次数:
303
2014多校7最水的题Magical ForestMagical ForestTime Limit: 24000/12000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 253Acc...
分类:
其他好文 时间:
2014-08-12 21:43:54
阅读次数:
310
http://acm.hdu.edu.cn/showproblem.php?pid=4941
比赛的时候现学的map的find...以前都是用下标做的,但是map用下标查询的话,如果查询的元素不存在,会插入一个新的元素。
贴一个map查找元素找到和找不到的模板
map,int>::iterator it=poshash.find(tmppos);//pai...
分类:
其他好文 时间:
2014-08-12 19:09:24
阅读次数:
262
#include
#include
#include
#include
using namespace std;
typedef struct node{
int x,y;
bool operator<(const node &b)const
{
if(x==b.x)
return y<b.y;
else
...
分类:
其他好文 时间:
2014-08-12 19:05:34
阅读次数:
249
在STL中,最常用的就是容器,最常用的容器就是vector了。想要了解vector如何动态增长等特性,看一下stl中vector的代码吧!...
分类:
其他好文 时间:
2014-08-12 17:12:34
阅读次数:
207
Check your gcc version. If it is less than 4.7, you need use another printer.py file. Get the file fromhttp://gcc.gnu.org/svn/gcc/branches/gcc-4_6-bra...
分类:
数据库 时间:
2014-08-12 16:43:44
阅读次数:
226
通过hash表。stl不存在hash容器,自己创建一个,共有256个字符,很简单就创建出来了
代码:
#include
//第一个出现一次的字符
using namespace std;
char findChar(char * pString){
if(pString == NULL)
return '\0';
const int tableSize = 256;
unsig...
分类:
其他好文 时间:
2014-08-12 13:37:44
阅读次数:
135