Sorry I meant C++ multiset.
You can solve it even without using priority queue. Use array[] to store count of exponent and traverse from Right to Left to pick maximum exponent.
Same here.
This approach is not correct as a sample when given test case is 1 50 answer should be 383 and in the approach u mentioned we will get 380
NO ,the answer is coming 383
here is link to my code with above mentioned approach
https://www.codechef.com/viewsolution/13348793
If a number can be written in terms of prime factors as-
18 (let)= 2^p x 3^q …
Then number of factors = (p+1)(q+1)
Here 18 = 2 x 3^2
So this makes number of factors as 6. Thats just another reasoning why 9 isnt the answer.
participate in discuss and reputation points will come across easily.
The tester’s code is praiseworthy. Simple, compact and easily understandable! Whosoever wrote it did an excellent job!!
Cool Well Explained !!