ll getsum(ll x) { ll sum1 = 0, sum2 = 0; for (; x; x -= lowbit(x)) { sum1 += c[x]; sum2 += b[x]; } return sum1 + sum2 * x; //x自减了还在使用 }
ll getsum(ll x) { ll sum1 = 0, sum2 = 0; ll y = x; for (; x; x -= lowbit(x)) { sum1 += c[x]; sum2 += b[x]; } return sum1 + sum2 * y; }
类似这样的还有while(n--)后再次使用n
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)