Getting in TLE in NUMFACT

Can somebody please help and tell me why am I getting TLE?I think my solution is very much optimized.
My code-CodeChef: Practical coding for everyone

There is no need to multiply all the numbers, you can factorize them separately, then also the result will be the same. This multiplication generates a very large number and is causing TLE.


In this question you are supposed to calculate the frequency of all the prime factors, then add one to these frequency and after this just multiply these values.

Here’s the link to the editorial: NUMFACT - Editorial - editorial - CodeChef Discuss

Here’s my solution for the same in java: CodeChef: Practical coding for everyone

1 Like