摘要:
题目链接:http://poj.org/problem?id=1195二维树状数组的应用 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 const int MAXN = 1200; 6 int S; 7 int C[MAXN][MAXN]; 8 9 int lowbit( int x )10 {11 return x & -x;12 }13 14 void Add( int x, int y, int add )15 {16 int tpy;17 while ( x 阅读全文
posted @ 2013-04-15 21:05
冰鸮
阅读(205)
评论(0)
推荐(0)
摘要:
题目链接:http://poj.org/problem?id=3321刷POJ分类的时候遇到的题,只知道是树状数组,但是分支编号不连续,不晓得怎么用树状数组求和。后来看了解题报告才知道需要把分支通过DFS映射成编号连续的,记录每个子树的起始位置和终止位置,然后再用树状数组求和。即使明白了思路,代码实现上也还是有很多地方不理解。唉,数据结构学得实在有够糟糕……树的邻接表表示法每次往表头插入节点也让我费解了好半天Orz…… 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 5 cons 阅读全文
posted @ 2013-04-15 20:42
冰鸮
阅读(159)
评论(0)
推荐(0)

浙公网安备 33010602011771号