将数组的下标分段的算法

比如将最大下标为13的数组分段,每段最多5个,则为

0   1    2   3  4

5    6   7   8  9

10 11 12 13

将最大小标为n的数组分段,每段最多m个,则为

0   …                                m-1

1*m  …                                2m -1

k*m…                               (k+1)*m – 1

(n 整除于 m) * m,  …          n

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.