题目链接 描述 There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing the big apple tree. The tree has N forks which are connected by branches. Kaka…
树状数组有两种情况:插点问线和插线问点.这道题是插线问点. 由于树状数组最简单的作用是计算1~x的和,所以给出(a, b. c).表示(a,b)区间添加c, 那我们仅仅须要在a点原来的基础上添加c,然后在b点原来的基础上更新-c,这样我们算终于结果的时候在(a. b)之间的就是添加了c.在区间之外的就是没有添加. 代码: #include <stdio.h> #include <string.h> #define M 1000005 int c[M], m; int lowbit(…