kindly explain the code given in editorial
Please explain the editorial code
Logic:
-
x = min(ci / ki), ci = max power of pi in n!, ki = max power of pi in K, pi = its prime factor;
So how to find ki…??
-
Simple just keep dividing K by pi till k%pi==0.
Now how to find ci…??
-
Basic PnC,
-
Highest power of pi in n! = floor(n / pi) + floor (n / (pi * pi)) + floor(n / (pi * pi * pi)) …
So the code is just direct implementation of this.
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.