Marks :20
: 2 | : 0
You are given a set of $$$n$$$ distinct prime numbers. You can make a new number by multiplying these numbers with each other. You can use any prime number as many times as you want.
Your task is to find the $$$k^{th}$$$ smallest number that you can make with the given set of prime numbers.
The first line of input contains two space seperated integers $$$n$$$ $$$(1 \le n \le 100)$$$ and $$$k$$$ $$$(1 \le k \le 10^5)$$$ — the number of primes in the set and the number $$$k$$$ specified in the problem.
The next line contains $$$n$$$ space separated integers given in ascending order denoting the elements of the set. It is guaranteed that the elements are distinct primes and do not exceed $$$10^3$$$.
Print a single integer — the $$$k^{th}$$$ smallest number you can make with the given set of prime numbers.
3 3 2 3 5
4
4 11 2 7 13 19
32
In sample testcase 1, the sequence of numbers that you can make with the given set of prime numbers is $$$2,3,4,5,6..$$$., hence the output is 4.
In sample testcase 2, the sequence of numbers that you can make with the given set of prime numbers is $$$2,4,7,8,13,14,16,19,26,28,32...$$$, hence the output is 32.
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.