## 分析

• 确实可以排序(LOL)
• 可以应对C-style array和C++-style container的排序需求
• 可以应用于任意random access container
• 可以使用用户自定义的排序函数 / 仿函数 / lambda函数

## 实现

### 函数原型

```template< class It, class Compare >
void sort …```

## A. 2月29日 (Feb. 29th)

### Description

Given a starting date and an ending date. Count how many Feb. 29th are between the given dates.

### Solution

The easiest way, of course, the brute force, which is quite simple with Python using the `datetime` lib.

However, it's not an effective way for the …

100组数据。

## ØMQ是一个消息系统

ZeroMQ是一个消息系统，也被称为“消息中间件”。它被广泛的用于经济、游戏、嵌入式等领域。

### ZeroMQ的起源和发展

ZeroMQ最先的设想是实现一个炒鸡快的用于证券交易的消息系统，所以在设计初期的关注点就是在极致的优化上。

## A. Fox And Snake

Implementation

```(n, m) = map(int, raw_input().split())

res = []

for i in xrange(n):
if i % 2 == 0:
res.append('#' * m)
elif (i / 2) % 2 == 0:
res.append('.' * (m - 1) + '#')
else:
res.append('#' + '.' * (m - 1))

for line in res:
print line
```

DFS …

## A. Maximum in Table

Simulation.

```n = int(raw_input())
g = [[1 for i in xrange(n)] for j in xrange(n)]

for i in xrange(1, n):
for j in xrange(1, n):
g[i][j] = g[i - 1][j] + g[i][j - 1]

print g[n - 1][n - 1]
```

## A. Pasha and Pixels

Brute force.

There are multiple ways to form a 2*2 square at one single step.

So at every step, we have to check the neighbours of pixel that is colored black.

```#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>

using namespace std;

#define …```

## Description

Given a sequence of integer numbers, try to find the median of the sequence.

### Extending

• Make sure your code can get the right answer in any conditions
• Make sure your code work effectively on some special kinds of sequence. For example, ordered sequence or a nearly ordered one, a …

• Type - 类型

• Length - 长度

• Value - 值

## 优势

• TLV序列方便遍历查找
• 新的字段可以无痛的加入现有的协议中。解析的时候，对于未知的字段，可以轻松的跳过。这点与XML类似
• TLV元素的顺序可以是随意的
• TLV元素通常使用二进制存储，可以使解析速度加快并且使数据更小
• TLV可以与XML数据相互转换，易于人类阅读

## 例子

### field_number ++ wire_type

```key = (field_number << 3) | wire_type
```

`field_number`标明了字段的编号，方便协议向前向后的兼容。而 …

## Reasons They Recruit

From Ace of Programming Interview, Cpt1 - Hiring Programmers: The Inside Story

## Establish a Rapport

For an interviewee, one the the most efficient way to build a rapport is to try to see things in from the interviewer's perspective.

• understand the motivation of the interviewer
• establishing a common ground