Need Help #PRMDIV problem


#1

problem url https://www.codechef.com/problems/PRMDIV

Can anyone help and chk my solution for above problem I am getting only one input test incorrect and rest all are correct can anyone chk my code and help me??

solution link: https://www.codechef.com/viewsolution/19404205


#2

https://discuss.codechef.com/questions/132598/prmdiv-editorial/132678


#3

freq is integer array multiplying 2 of them might cause overflow.

AC code:https://www.codechef.com/submit/complete/19404484


#4

changed it to long freq and got correct but I didn’t got your point if you could elaborate how freq would get overflow if my freq count will always be less than 1000000 and my variable count which multiplies freq is already long.


#5

Read type conversion in JAVA and C++. First, freq* is int. Intermediate-Product of 2 int is stored in int. Overflow happens. Then this overflowed result stored in count.