Index | Diary 2024-05-19

前缀和

Algoryithm

定义 \(pre(x)\) 为区间 \([0,x]\) 中奇数的个数

则显然

$$ pre(x) = \frac{x+1}{2} $$