是只需将 add 和 query 中的 for(;x<=n;x+=lowbit(x)) 和 for(;x;x-=lowbit(x)) 调换位置就可以了吗?
add
query
for(;x<=n;x+=lowbit(x))
for(;x;x-=lowbit(x))