Update bit.cpp

This commit is contained in:
John Law 2019-10-09 00:02:29 +08:00 committed by GitHub
parent 883d9dc3a4
commit dba806ca60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,7 +6,7 @@ using namespace std;
class Bit class Bit
{ {
int n; int n;
vector < int > bit; vector<int> bit;
inline int offset(int x) inline int offset(int x)
{ {
return (x & (-x)); return (x & (-x));
@ -14,7 +14,7 @@ class Bit
public: public:
Bit(vector < int > & arr) Bit(vector<int>& arr)
{ {
n = arr.size(); n = arr.size();
bit.assign(n + 1, 0); bit.assign(n + 1, 0);
@ -62,7 +62,7 @@ class Bit
int main() int main()
{ {
int n = 5; int n = 5;
vector <int> arr = { 1, 2, 3, 4, 5 }; vector<int> arr = { 1, 2, 3, 4, 5 };
Bit x(arr); Bit x(arr);
assert(x.sum_range(0, 0) == 1); assert(x.sum_range(0, 0) == 1);