bzoj 2038 [2009国家集训队]小Z的袜子(hose)

\[ans_{i}=\frac{\sum_{i=l}^r \dbinom{2}{cnt_{i}}}{\dbinom{2}{r-l+1}} \]

\[ans_{i}=\frac{\sum_{i=l}^r \frac{cnt_{i}\times (cnt_{i}-1)}{2}}{\frac{(r-l+1)\times (r-l)}{2}} \]

\[ans_{i}=\frac{\sum_{i=l}^r cnt_{i}\times (cnt_{i}-1)}{(r-l+1)\times (r-l)} \]

\[ans_{i}=\frac{\sum_{i=l}^r cnt_{i}^2-cnt_{i}}{(r-l+1)\times (r-l)} \]

\[ans_{i}=\frac{\sum_{i=l}^r cnt_{i}^2 - \sum_{i=l}^r cnt_{i}}{(r-l+1)\times (r-l)} \]

因为

\[\sum_{i=l}^r cnt_{i}=r-l+1 \]

所以

\[ans_{i}=\frac{\sum_{i=l}^r cnt_{i}^2 -(r-l+1)}{(r-l+1)\times (r-l)} \]

posted @ 2018-08-17 09:53  hzf29721  阅读(198)  评论(1编辑  收藏  举报