git reimport
This commit is contained in:
42
archive/2018.10/2018.10.15 - SNCKQL19/TaskA.java
Normal file
42
archive/2018.10/2018.10.15 - SNCKQL19/TaskA.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package chelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import io.InputReader;
|
||||
import io.OutputWriter;
|
||||
import misc.SimpleSavingChelperSolution;
|
||||
|
||||
|
||||
public class TaskA extends SimpleSavingChelperSolution {
|
||||
|
||||
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();
|
||||
|
||||
List<Integer> teams = new ArrayList<>();
|
||||
for (int i = 0; i < n; i++) {
|
||||
teams.add(in.nextInt());
|
||||
}
|
||||
|
||||
teams.sort((o1, o2) -> -Integer.compare(o1, o2));
|
||||
|
||||
int res = 0;
|
||||
int cutoff = teams.get(k - 1);
|
||||
|
||||
for (Integer team : teams) {
|
||||
if (team >= cutoff) {
|
||||
res++;
|
||||
}
|
||||
}
|
||||
|
||||
out.println(res);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user