题意:在一张有向图中输出所有的环。思路:先用Floyd求传递闭包,然后通过传递闭包建图若是Map[i][j] && Map[j][i]则建一条无向边。然后图中所有的连通分支即为一个环。代码如下: 1 /************************************************....
分类:
其他好文 时间:
2014-06-27 18:21:27
阅读次数:
222
Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.Fo...
分类:
移动开发 时间:
2014-06-27 16:53:38
阅读次数:
262
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
分类:
移动开发 时间:
2014-06-27 12:51:24
阅读次数:
258
题目大意:
分析长度为n的子串有多少种。
思路分析:
对于没出现的字符,将其分配一个数字。
然后将子串看做一个nc进制的数。
然后hash判断。
#include
#include
#include
#include
#include
#include
using namespace std;
bool vis[26666666];
int val[30...
分类:
其他好文 时间:
2014-06-27 09:45:35
阅读次数:
184
KM 求权值最小的完美匹配
Going Home
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 17309
Accepted: 8824
Description
On a grid map there are n little...
分类:
其他好文 时间:
2014-06-27 08:56:18
阅读次数:
135
关联容器操作
关联容器中还定义了三个类型,如下:
set::value_type v1; //这个v1是string类型
set::key_type v2; //这个v2是string类型
map::value_type v3; //v3是pair类型pair
map::key_type v4; //v4是stri...
分类:
编程语言 时间:
2014-06-27 08:19:46
阅读次数:
284
题目链接:点击打开链接
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
#define N 5001000
#define mod 1000000007
#define he...
分类:
其他好文 时间:
2014-06-27 07:35:50
阅读次数:
178
本题就是给出一个数k和一个数组,包括N个元素,通过每次增加数组中的一个数的操作,最后需要得到1 - N的一个序列,不用排序。
可以从暴力法入手,然后优化。
这里利用hash表进行优化,最终得到时间效率是O(n*n)的算法,而且常数项应该很低,速度还挺快的。
思路:
1 如果数组A[i]在1 -N 范围内,就利用bool B[]记录,这个数已经找到了;
2 如果A[i]的值之前已经找到了,...
分类:
其他好文 时间:
2014-06-26 12:01:28
阅读次数:
349
//通用封装好的js:var map = new BMap.Map("container"); //建树Map实例var point = new BMap.Point(103.976032, 33.845509); // 建树点坐标map.centerAndZoom(point, 6); // 初始...
分类:
数据库 时间:
2014-06-26 11:23:33
阅读次数:
606
2. map简介map是一类关联式容器。它的特点是增加和删除节点对迭代器的影响很小,除了那个操作节点,对其他的节点都没有什么影响。对于迭代器来说,可以修改实值,而不能修改key。3. map的功能自动建立Key - value的对应。key 和 value可以是任意你需要的类型。根据key值快速查找...
分类:
其他好文 时间:
2014-06-26 11:22:57
阅读次数:
233