Problem :-
link text
My solution:- link text
Input cases for which my solution is wrong:- link text
Algorithm used same as others still i dont understand:-
- Generate prime numbers upto max query number or max number.
- Generate multiples of two primes (including prime squares) upto the limit.
- For each query we have to tell whether we can reach to any number generated in Step 2. For this
we can generate all possible numbers, by multiplying Step 2 numbers with the given array numbers,
repeatedly. Again we will check upto the max query number only. Using ordered (sorted) numbers
with max number condition, we can reduce the time complexity significantly.
I have followed same logic if im not wrong . Plz help me. Whats mistake i cannot identify i tried very hard.