Minimize the sum of errors of representative integers

前端 未结 8 2331
滥情空心
滥情空心 2021-02-07 20:15

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:34

    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

提交回复
热议问题