git reimport
This commit is contained in:
52
archive/2018.03/2018.03.18 - unsorted/TaskB.java
Normal file
52
archive/2018.03/2018.03.18 - unsorted/TaskB.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.GCJSolution;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskB extends GCJSolution {
|
||||
|
||||
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
||||
wrapSolve(testNumber, in, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void solve(int testNumber) {
|
||||
int n = in.nextInt();
|
||||
|
||||
int k = in.nextInt();
|
||||
|
||||
double[] a = in.nextDoubleArray(n);
|
||||
|
||||
double dipVal = 0;
|
||||
|
||||
// int removed = 0;
|
||||
//
|
||||
// List<Double> vals = new ArrayList<>();
|
||||
//
|
||||
// for (int i = 0; i < ; i++) {
|
||||
//
|
||||
// }
|
||||
|
||||
for (int i = 0; i < k + 1; i++) {
|
||||
double sum = 0;
|
||||
|
||||
for (int j = 0; j < n; j++) {
|
||||
if (a[j] < dipVal) {
|
||||
sum += dipVal / n;
|
||||
} else {
|
||||
sum += a[j] / n;
|
||||
}
|
||||
}
|
||||
|
||||
dipVal = sum;
|
||||
}
|
||||
|
||||
out.println(dipVal);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user