Time Limit Exceeding please check

time limit is exceeding please check
code ide is https://ide.codingblocks.com/s/137410

Hi @souravmunjal2000
You have applied bruteforce to this problem , certainly giving TLE.
Proceed this way:
1.Calculate N
2. Get the factors of N ( we don’t need to run the loop till N, think how).
3.keep on calculating the number of times a prime occurs in that number ( for eg. 2 occurs thrice in 24)
4. If P is of the form a^b * c^d * e^f
then number of divisors are (b+1)(d+1)(f+1)

I hope you have understood the method. Try to analyse the algorithm with the sample test case.
Goodluck :slight_smile:

i have written some new code please check after calculating P in the question code ide is - https://ide.codingblocks.com/s/138489

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.