#C10754. Minimum Points for Top K Percent

    ID: 39994 Type: Default 1000ms 256MiB

Minimum Points for Top K Percent

Minimum Points for Top K Percent

You are given n employees with their respective points and a percentage threshold K. Your task is to determine the minimum number of points required to be among the top K percent of employees. In other words, after sorting the points in descending order, you must return the point value at the position that marks the end of the top K percent.

More formally, let n be the total number of employees and let the number of top employees be defined as

$$\text{top_count} = \lceil \frac{n \times K}{100} \rceil, $$

where \(\lceil x \rceil\) is the ceiling function of \(x\). After sorting in non-increasing order, the answer is the point value at index (top_count - 1) (if using 0-indexing).

Input/Output Requirement: The program must read from standard input (stdin) and write the result to standard output (stdout).

inputFormat

The input consists of two lines:

  • The first line contains two integers n and K separated by a space, where n is the total number of employees and K is the percentage threshold.
  • The second line contains n space-separated integers representing the points of the employees.

You may assume that n > 0 and 0 < K ≤ 100.

outputFormat

The output is a single integer which is the minimum number of points required to be in the top K percent.

## sample
6 50
100 200 150 80 120 70
120

</p>