PivotOJ

Adjusted Average

시간 제한: 8000ms메모리 제한: 1024MB출처: BAPC 2022BOJ 25992

문제

As a student of the Biology And Probability Course at your university, you have just performed an experiment as part of the practical assignments. However, your results do not look very nice: you had hoped that the average of your samples would be different from what it is now.

To improve your results, you decide to let some of your samples "magically disappear" (i.e., dump them in the waste bin). In order to not raise suspicion with your teacher, you can remove only a few of your samples. How close can you possibly get to your desired average?

입력

The input consists of:

  • One line with three integers nn, kk, and x\overline{x} (2n15002 \leq n \leq 1500, 1k41 \leq k \leq 4, k<nk < n, x109\left| \overline{x} \right| \leq 10^9), the number of samples, the number of samples that may be removed, and the average you think looks the nicest.
  • One line with nn integers xx (x109\left| x \right| \leq 10^9), representing the samples.

출력

Output the minimal absolute difference between x\overline{x} and the average you can obtain by removing at most kk samples from the dataset.

Your answer should have an absolute error of at most 10410^{-4}.

예제

예제 1

입력
5 2 2
1 2 3 100 200
출력
0

예제 2

입력
5 4 -5
-6 -3 0 6 3
출력
0.5
코드를 제출하려면 로그인하세요.