DescriptionBefore the invention of book-printing, it was very hard to make a copy of a book. All the contents had to be re-written by hand by so calle...
分类:
其他好文 时间:
2015-08-08 17:55:43
阅读次数:
115
DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping ...
分类:
其他好文 时间:
2015-08-07 22:03:44
阅读次数:
107
Given several segments of line (int the X axis) with coordinates [Li , Ri ]. You are to choose the minimal amount of them, such they would completely ...
分类:
其他好文 时间:
2015-08-06 22:10:06
阅读次数:
100
My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. ....
分类:
其他好文 时间:
2015-08-06 11:00:01
阅读次数:
104
/proc/meminfo Explained "Free," "buffer," "swap," "dirty." What does it all mean? If you said, "something to do with the Summer of ‘68", you may need a primer on ‘meminfo‘. The entries in the /proc...
分类:
其他好文 时间:
2015-08-05 20:35:31
阅读次数:
170
A. CodeForces 396C
题意就不描述啦。
对于第一种操作 1 v x k,我们可以给v的子树全部加上(x+depth[v]*k)的值。
对于第二种操作 2 v。查询每个节点的值之后,只需要在减去depth[v]*K即可得到答案了。里面的K是对v这个节点有影响的k的和。
自己在纸上推推公式,很容易就能知道为何是对的了
这里用两个树状数组即可维护,
当然增加整棵子树的操作...
分类:
其他好文 时间:
2015-08-03 19:13:38
阅读次数:
136
Description我们知道,在编程中,我们时常需要考虑到时间复杂度,特别是对于循环的部分。例如, 如果代码中出现 for(i=1;i 2 using namespace std; 3 const int maxn=2000+20; 4 int p[maxn][maxn]; 5 void set(...
分类:
其他好文 时间:
2015-08-02 19:58:02
阅读次数:
116
Today on a lecture about strings Gerald learned a new definition of string equivalency. Two stringsaandbof equal length are calledequivalentin one of ...
分类:
其他好文 时间:
2015-08-02 19:57:29
阅读次数:
623
Description在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个...
分类:
其他好文 时间:
2015-08-02 19:52:36
阅读次数:
76
Description给你一个高为n ,宽为m列的网格,计算出这个网格中有多少个矩形,下图为高为2,宽为4的网格. Input第一行输入一个t, 表示有t组数据,然后每行输入n,m,分别表示网格的高和宽 ( n 2 using namespace std; 3 int main() 4 { 5 .....
分类:
其他好文 时间:
2015-08-02 19:47:17
阅读次数:
129