[A factorial problem]

problem : https://hack.codingblocks.com/contests/c/473/897
code : https://ide.codingblocks.com/#/s/14426

I am trying to solve this problem with the logic that the highest power of k present in n! is the total number of occurrences of k in n!.
e.g.
for n = 5 and k = 2
occurrences of 2 :-
1 -> 0
2 -> 1
3 -> 0
4 -> 2
5 -> 0
total = 3, so highest power of k in n! would be 3 &
5! % 2^3 = 0.
Still getting WA, please give any hints to where it is wrong.

You aren’t handling the case k > n.
Test case :
1
5 8
Output should be 1

1 Like

:+1::+1: got it, thanks. Here I thought the editorial was doing extra work. :disappointed_relieved::grin: