返回列表 发帖
当0 < n < 5时,f(n!) = 0;
当n >= 5时,f(n!) = k + f(k!), 其中 k = n / 5(取整)

算法题
http://www.chinaunix.net/jh/23/926848.html

TOP

本帖最后由 plp626 于 2012-3-5 22:01 编辑
@echo off
call:f 10000 ans
set ans
pause
:f <int> <ret> //求%1阶乘尾数的零个数;f(n)=f(n/5)+n/5;f([1,4])=0
set/a #1=%1
if %#1%==0 (set %2=0)else call:f %1/5 %2&set/a %2+=%1/5COPY

TOP

返回列表