6
19
2014
0

Binary Indexed Tree

namespace bit{
    const int N=500000;
    int n,a[N+10];
    void add(int x,int d){for(;x<=n;x+=x&-x)a[x]+=d;}
    int sum(int x){int r=0;for(;x;x-=x&-x)r+=a[x];return r;}
}
Category: 未分类 | Tags: | Read Count: 506

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com