SPOJ #11 Factorial

Counting trailing 0s of n! It is not very hard to figure out how to count it - simply count how many 5s. Since even numbers are always more than 5s, we don‘t have to consider even numbers.

But counting 5, is tricky. Naive method is quite slow - I got 12+s for 1000000000. And after reading below article, I got 0.04s. The former counts individually, duplicated; but the latter counts smart:
http://en.wikipedia.org/wiki/Trailing_zeros#Factorial

SPOJ #11 Factorial

上一篇:信念、思考、行动-谈谈程序员返回家乡的创业问题


下一篇:vue-amap地图组件上的折线以及高德地图经纬度的引入