转自:http://blog.csdn.net/holybin/article/details/26050897 0 概述 虽然hash_map和map都是STL的一部分,但是目前的C++标准(C++11)中只有map而没有hash_map,可以说STL只是部分包含于目前的C++标准中。主流的GNU...
分类:
其他好文 时间:
2014-07-18 19:20:07
阅读次数:
316
【程序员编程艺术】学习记录2:左旋转字符串之循环移位法
GCD算法:(辗转相除法/欧几里得算法)
gcd是求最大公约数的算法,作为TAOCP第一个算法
gcd算法流程:
首先给定两个整数m,n(m大于等于n)如果小于则直接交换再处理
①求余数 r=m%n
②假如r=0,算法结束,n即为所求
否则,重新令m
STL中rotate算法:
对于数组移位问题,可以采用下面方法:...
分类:
其他好文 时间:
2014-07-18 16:38:35
阅读次数:
243
油田问题,有点像图像处理里的区域生长问题,找油田块数。BFS,DFS都可以。 1 /*BFS*/ 2 #include 3 #include 4 const int maxn=100+5,maxm=1000; 5 int m,n,vis[maxn][maxn],mat[maxn][maxn],dir...
分类:
其他好文 时间:
2014-07-18 16:19:41
阅读次数:
267
Children of the Candy Corn
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 9311
Accepted: 4039
Description
The cornfield maze is a popular Hallowee...
分类:
其他好文 时间:
2014-07-17 21:09:46
阅读次数:
319
题意:这题从二维空间扩展到三维空间了,可以上下左右前后移动,每次都只能移到相邻的空位,
每次需要花费一分钟,求从起点到终点最少要多久
#表示岩石,.表示空位,S是起点,E是终点...
分类:
其他好文 时间:
2014-07-17 19:20:47
阅读次数:
237
简单搜索
直接代码:
#include
#include
#include
#include
using namespace std;
char a,c;
int e,f;
int dx[8] = {-2, -2, -1, -1, 1, 1, 2, 2};
int dy[8] = {-1, 1, -2, 2, -2, 2, -1, 1};
int qq[9][9];
struct node
{...
分类:
其他好文 时间:
2014-07-17 19:05:30
阅读次数:
265
这题要用BFS去做,要注意的是’x‘,这里可以有优先队列去做,会很简单;另一个要注意的是,a只有一个,r可能有很多个,所以可以用a去找最接近的r;#include #include #include "string.h"using namespace std;struct step{ int x,y...
分类:
其他好文 时间:
2014-07-17 18:13:36
阅读次数:
180
题解:数据结构的基本操作,用STL可以完美实现,就是比较慢……#include #include #include #include #include const int MAXN=500005; const int INF=~0U>>1; using namespace std; ...
分类:
其他好文 时间:
2014-07-17 17:39:20
阅读次数:
193
hdu 1198 Farm Irrigation(深搜dfs || 并查集)...
分类:
其他好文 时间:
2014-07-17 15:18:32
阅读次数:
282
Dungeon Master
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 16178
Accepted: 6268
Description
You are trapped in a 3D dungeon and need to find th...
分类:
其他好文 时间:
2014-07-17 10:16:30
阅读次数:
235