HDU 1124 Factorial 水题
题意:统计n!后面有几个0, 2肯定够用,只要算n!里有几个5就可以了

#include<cstdio> #include<cstring> int main() { int cas, n; scanf("%d", &cas); while(cas--) { scanf("%d", &n); int s = 5, ans = 0; while(s <= n) ans += n/s, s *= 5; printf("%d\n", ans); } return 0; }