Ordering Number

Ordering Number

সময় লিমিট: 1.0 s

মেমরি লিমিট: 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

Information

ID
1008
Difficulty
7
Category
Implementation | Sorting দেখানোর জন্য ক্লিক করুন
Tags
(None)
# Submissions
15
Accepted
8
Accepted Ratio
53%
Uploaded By

Related

In following contests:

Beta Round #1