先看这篇文章
http://journal.stuffwithstuff.com/2013/12/08/babys-first-garbage-collector/
一个很小的GC,如何实现的呢?看一下源代码
#include
#include
#define STACK_MAX 256
typedef enum {
OBJ_INT,
OBJ_PAIR
} Obj...
分类:
其他好文 时间:
2015-01-12 14:42:04
阅读次数:
152
-One such related pair of patterns is the concept
of an executor service that manages tasks and that of a thread pool that services tasks in
an efficient way.
-The new Callable interface, whic...
分类:
编程语言 时间:
2015-01-09 00:18:47
阅读次数:
365
在项目当中有要用到map按key排序的需求,就在百度上搜了一下:typedef pair PAIR;int cmp(const PAIR& x, const PAIR& y){return x.second imgdis; //待排序对象,根据double值排序imgdis[1] = 3;imgd....
分类:
编程语言 时间:
2015-01-08 22:36:40
阅读次数:
558
题目是 小明迷路了,求出他的方位,具体的题目没了,所以没有弄过来,希望大家海涵或者提供一下
#include
#include
#include
using namespace std;
int N;
int M;
char ** allmap;
char ** side;
int const side_length = 3;
const pair error = make...
分类:
其他好文 时间:
2015-01-07 23:37:41
阅读次数:
325
#include
#include
#include
#include
#include
int main (int argc, char *argv[])
{
typedef int KeyType;
typedef float MappedType;
typedef std::pair ValueType;
typedef boost::interp...
分类:
其他好文 时间:
2015-01-05 20:32:30
阅读次数:
511
这个是非常经典的树分治的题目,关于60分的做法.参见poj1741按照树分治的惯例,先全局统计,然后再减掉重复的东西.那么如何计算贡献呢?我们按照poj1741的方法.先将满足一维的情况的数据全部放入一个树状数组里面,然后我们就能够一维统计了.复杂度O(nlog2n)代码也比较凑合....#incl...
分类:
其他好文 时间:
2015-01-04 22:55:24
阅读次数:
262
A non-empty zero-indexed array A consisting of N integers is given.A pair of integers (P, Q) is called K-complementary in array A if 0 ≤ P, Q map = n....
分类:
其他好文 时间:
2015-01-04 01:06:03
阅读次数:
518
aws 阿里云 比较
使用了 阿里云 和 aws服务。
阿里云很方便,交了钱,按步骤部署就好。
交了钱给公用IP,没交钱给私用IP测试用,非常简单。
用了几个小时就完成部署,登陆开始必要的服务器软件安装等等。
aws还要搞个elastic ip新概念出来,还有key pair。折腾了1天还没搞出来。
key pair的管理可以增加多个,但是不能绑定一个instance。...
分类:
其他好文 时间:
2015-01-04 00:02:21
阅读次数:
501
题目链接:hdu 5148 Cities
dp[i][j]表示以i为根节点,选j个最优值,每条边被选中的时候就计算出被经过的次数,并乘上权值。
#include
#include
#include
#include
using namespace std;
typedef pair pii;
typedef long long ll;
const int maxn = 20...
分类:
其他好文 时间:
2015-01-03 22:27:38
阅读次数:
260
ES6 provides Map, it is a set of k-v pair. Key can be number, string, object, function and even undefined.var m = new Map();Methods:1. set(k,v)m.set("...
分类:
其他好文 时间:
2015-01-02 06:29:26
阅读次数:
167