Ordering Number

Ordering Number

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

Time Limit: 1.0 s

Memory Limit: 64.0 MB

Number v is a Divisor of a number u, if u is divisible by v.

Given an array, order it by the following condition.

x will come before y if

  • number of divisors of x is less than number of divisors of y
  • number of divisors of x is equal to number of divisors of y and x > y.

After ordering, print the kth number.

Input format:

T number of case, T <= 100
N = size of array, N <= 1000
A[i].....A[n] = array. A[i] <= 10000
K = kth number to print. K <= N

Output format:

X, where X = kth number after ordering the array.

Sample Input:

2
10
1 2 3 4 5 6 7 8 9 10
5
5
1 2 3 5 7
3

Sample Output:

2
5

Beta Round #1

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
5
Start at
2023-11-29 16:00
End at
2023-11-29 18:00
Duration
2.0 hour(s)
Host
Partic.
23