Minimize the sum of errors of representative integers

前端 未结 8 699
走了就别回头了
走了就别回头了 2021-02-07 20:13

Given n integers between [0,10000] as D1,D2...,Dn, where there may be duplicates, and n can be huge:

I want to find k distinct represent

8条回答
  •  误落风尘
    2021-02-07 20:26

    one first obvious point is that your Rs must be chosen amongst your Ds. (if you choose an R that is any D - 1 (but not another D), you'll improve the answer by incrementing your R by 1)

    a second point is that your last R is useless and its error will always be 0

提交回复
热议问题