numTest = int(input())
result = ''
for i in range(numTest):
N = int(input())
N_Z = 0
while N > 0:
N //=5
N_Z+=N
result+= '{}\n'.format(N_Z)
print(result)
I use this way to solve this problem but I get a TLE. after thinking and thinking, I can't think any better way to solve this. Did anyone has any better idea?

New Topic/Question
Reply



MultiQuote





|