Hello,
I am attempting to do this <https://www.spoj.pl/problems/FCTRL/> project for
the Sphere Online Judge.
I think my program is getting the right answer, however it exceeds the 6s
time limit on the judge machine.
Here is my code:
############
import sys
testnums = []
tests = int(sys.stdin.readline())
for count in xrange(tests):
testnums.append(int(sys.stdin.readline()))
for d in testnums:
maxer = int(d ** .2) + 1
g = sum(d / (5 ** x) for x in xrange(1, maxer))
sys.stdout.write('%d\n' % g)
############
Any ideas on how to speed this up?
Also, if anyone is familiar with the Online Judge system, am I correct in
gathering all of the input first and then providing the output? Or should I
be providing output after each input?
Any help appreciated,
Ian.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor