版本比较
树状数组
正文
增加 5 行删除 5 行
184 行未改动全部展开1851861871881891901891901911921931942 行未改动19719819920020120120220320420544 行未改动25025125225325425425525625725897 行未改动356357358359360360361362363364223 行未改动全部展开184 行未改动全部展开signed main(){ cin>>n>>q; for(int v,i=1;i<=n;i++){ cin>>v; update(i,v); } update(i,v); } for(int i=1;i<=q;i++){ int op,l,r; cin>>op>>l>>r; if(op==1){2 行未改动 cout<<query(r)-query(l-1)<<endl;//区间查询求前缀和 } } return 0;} }```
### T2.[U438249 清点人数](https://www.luogu.com.cn/problem/U438249)
44 行未改动 update(m,-p);//减就是负数 } } return 0;} }```
### T3.[P3368 【模板】树状数组 2](https://www.luogu.com.cn/problem/P3368)
97 行未改动 cout<<query(x)<<endl; } } return 0;} }```
### 离散化223 行未改动全部展开