fctrl: why my code is showing time limit exeeded.

why my code is showing time limit exceededlink text

Initialize s and m inside the for loop and instead of calculating s every time multiply with 5(s=s*5). Also write endl after printing c for every test case .

while(N%s!=0)

Will it not cause an infinite loop?

Like, say, N=4.

4%5=4
4%25=4
4%125=4
.
.

and similarly condition holds true for such s. Can you please give t a re-look? :slight_smile:

still showing limit exceeded
https://www.codechef.com/viewsolution/14432791

Again take my input. 4/5 =0 and 0!=1 is true always. Again infinite loop. Replace “!=” with “<=” and tell me the results.