Codeforces Round #289 (Div. 2) Tutorial

A. Maximum in Table


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]

B …

more ...

Codeforces Round #288 (Div. 2)

A. Pasha and Pixels

Brute force.

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

Alt text

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 …
more ...

Sequence Median


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


  • 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 …
more ...


在数据通信协议中,可选的信息或字段通常使用type-length-value(a.k.a TLV)元素来进行编码。

  • Type - 类型


  • Length - 长度


  • Value - 值



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



field_number ++ wire_type


key = (field_number << 3) | wire_type

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

more ...

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
  • adapting your …
more ...